numaif.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * tools/testing/selftests/kvm/include/numaif.h
  4. *
  5. * Copyright (C) 2020, Google LLC.
  6. *
  7. * This work is licensed under the terms of the GNU GPL, version 2.
  8. *
  9. * Header file that provides access to NUMA API functions not explicitly
  10. * exported to user space.
  11. */
  12. #ifndef SELFTEST_KVM_NUMAIF_H
  13. #define SELFTEST_KVM_NUMAIF_H
  14. #define __NR_get_mempolicy 239
  15. #define __NR_migrate_pages 256
  16. /* System calls */
  17. long get_mempolicy(int *policy, const unsigned long *nmask,
  18. unsigned long maxnode, void *addr, int flags)
  19. {
  20. return syscall(__NR_get_mempolicy, policy, nmask,
  21. maxnode, addr, flags);
  22. }
  23. long migrate_pages(int pid, unsigned long maxnode,
  24. const unsigned long *frommask,
  25. const unsigned long *tomask)
  26. {
  27. return syscall(__NR_migrate_pages, pid, maxnode, frommask, tomask);
  28. }
  29. /* Policies */
  30. #define MPOL_DEFAULT 0
  31. #define MPOL_PREFERRED 1
  32. #define MPOL_BIND 2
  33. #define MPOL_INTERLEAVE 3
  34. #define MPOL_MAX MPOL_INTERLEAVE
  35. /* Flags for get_mem_policy */
  36. #define MPOL_F_NODE (1<<0) /* return next il node or node of address */
  37. /* Warning: MPOL_F_NODE is unsupported and
  38. * subject to change. Don't use.
  39. */
  40. #define MPOL_F_ADDR (1<<1) /* look up vma using address */
  41. #define MPOL_F_MEMS_ALLOWED (1<<2) /* query nodes allowed in cpuset */
  42. /* Flags for mbind */
  43. #define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */
  44. #define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to mapping */
  45. #define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */
  46. #endif /* SELFTEST_KVM_NUMAIF_H */