group.c 590 B

1234567891011121314151617181920212223242526272829
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include <stdio.h>
  3. #include "api/fs/fs.h"
  4. #include "util/group.h"
  5. /*
  6. * Check whether we can use a group for top down.
  7. * Without a group may get bad results due to multiplexing.
  8. */
  9. bool arch_topdown_check_group(bool *warn)
  10. {
  11. int n;
  12. if (sysctl__read_int("kernel/nmi_watchdog", &n) < 0)
  13. return false;
  14. if (n > 0) {
  15. *warn = true;
  16. return false;
  17. }
  18. return true;
  19. }
  20. void arch_topdown_group_warn(void)
  21. {
  22. fprintf(stderr,
  23. "nmi_watchdog enabled with topdown. May give wrong results.\n"
  24. "Disable with echo 0 > /proc/sys/kernel/nmi_watchdog\n");
  25. }