No users of get_max_numa_node(), is_numa_available(), or
is_multi_numa_node_system() remain.  Remove the helpers and the now
unused dirent.h include.

Signed-off-by: Shivank Garg <[email protected]>
---
 tools/testing/selftests/kvm/include/numaif.h | 52 ----------------------------
 1 file changed, 52 deletions(-)

diff --git a/tools/testing/selftests/kvm/include/numaif.h 
b/tools/testing/selftests/kvm/include/numaif.h
index 0945500c6322..c3884017ebb8 100644
--- a/tools/testing/selftests/kvm/include/numaif.h
+++ b/tools/testing/selftests/kvm/include/numaif.h
@@ -4,8 +4,6 @@
 #ifndef SELFTEST_KVM_NUMAIF_H
 #define SELFTEST_KVM_NUMAIF_H
 
-#include <dirent.h>
-
 #include <linux/bitmap.h>
 #include <linux/mempolicy.h>
 
@@ -73,54 +71,4 @@ static inline int kvm_get_next_numa_node(unsigned long 
nodemask, int from)
        return to;
 }
 
-static inline int get_max_numa_node(void)
-{
-       struct dirent *de;
-       int max_node = 0;
-       DIR *d;
-
-       /*
-        * Assume there's a single node if the kernel doesn't support NUMA,
-        * or if no nodes are found.
-        */
-       d = opendir("/sys/devices/system/node");
-       if (!d)
-               return 0;
-
-       while ((de = readdir(d)) != NULL) {
-               int node_id;
-               char *endptr;
-
-               if (strncmp(de->d_name, "node", 4) != 0)
-                       continue;
-
-               node_id = strtol(de->d_name + 4, &endptr, 10);
-               if (*endptr != '\0')
-                       continue;
-
-               if (node_id > max_node)
-                       max_node = node_id;
-       }
-       closedir(d);
-
-       return max_node;
-}
-
-static bool is_numa_available(void)
-{
-       /*
-        * Probe for NUMA by doing a dummy get_mempolicy().  If the syscall
-        * fails with ENOSYS, then the kernel was built without NUMA support.
-        * if the syscall fails with EPERM, then the process/user lacks the
-        * necessary capabilities (CAP_SYS_NICE).
-        */
-       return !get_mempolicy(NULL, NULL, 0, NULL, 0) ||
-               (errno != ENOSYS && errno != EPERM);
-}
-
-static inline bool is_multi_numa_node_system(void)
-{
-       return is_numa_available() && get_max_numa_node() >= 1;
-}
-
 #endif /* SELFTEST_KVM_NUMAIF_H */

-- 
2.43.0


Reply via email to