numaif.h (1656B)
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 13#ifndef SELFTEST_KVM_NUMAIF_H 14#define SELFTEST_KVM_NUMAIF_H 15 16#define __NR_get_mempolicy 239 17#define __NR_migrate_pages 256 18 19/* System calls */ 20long get_mempolicy(int *policy, const unsigned long *nmask, 21 unsigned long maxnode, void *addr, int flags) 22{ 23 return syscall(__NR_get_mempolicy, policy, nmask, 24 maxnode, addr, flags); 25} 26 27long migrate_pages(int pid, unsigned long maxnode, 28 const unsigned long *frommask, 29 const unsigned long *tomask) 30{ 31 return syscall(__NR_migrate_pages, pid, maxnode, frommask, tomask); 32} 33 34/* Policies */ 35#define MPOL_DEFAULT 0 36#define MPOL_PREFERRED 1 37#define MPOL_BIND 2 38#define MPOL_INTERLEAVE 3 39 40#define MPOL_MAX MPOL_INTERLEAVE 41 42/* Flags for get_mem_policy */ 43#define MPOL_F_NODE (1<<0) /* return next il node or node of address */ 44 /* Warning: MPOL_F_NODE is unsupported and 45 * subject to change. Don't use. 46 */ 47#define MPOL_F_ADDR (1<<1) /* look up vma using address */ 48#define MPOL_F_MEMS_ALLOWED (1<<2) /* query nodes allowed in cpuset */ 49 50/* Flags for mbind */ 51#define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */ 52#define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to mapping */ 53#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */ 54 55#endif /* SELFTEST_KVM_NUMAIF_H */