162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * tools/testing/selftests/kvm/include/numaif.h 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2020, Google LLC. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * This work is licensed under the terms of the GNU GPL, version 2. 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * Header file that provides access to NUMA API functions not explicitly 1062306a36Sopenharmony_ci * exported to user space. 1162306a36Sopenharmony_ci */ 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#ifndef SELFTEST_KVM_NUMAIF_H 1462306a36Sopenharmony_ci#define SELFTEST_KVM_NUMAIF_H 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#define __NR_get_mempolicy 239 1762306a36Sopenharmony_ci#define __NR_migrate_pages 256 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci/* System calls */ 2062306a36Sopenharmony_cilong get_mempolicy(int *policy, const unsigned long *nmask, 2162306a36Sopenharmony_ci unsigned long maxnode, void *addr, int flags) 2262306a36Sopenharmony_ci{ 2362306a36Sopenharmony_ci return syscall(__NR_get_mempolicy, policy, nmask, 2462306a36Sopenharmony_ci maxnode, addr, flags); 2562306a36Sopenharmony_ci} 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_cilong migrate_pages(int pid, unsigned long maxnode, 2862306a36Sopenharmony_ci const unsigned long *frommask, 2962306a36Sopenharmony_ci const unsigned long *tomask) 3062306a36Sopenharmony_ci{ 3162306a36Sopenharmony_ci return syscall(__NR_migrate_pages, pid, maxnode, frommask, tomask); 3262306a36Sopenharmony_ci} 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci/* Policies */ 3562306a36Sopenharmony_ci#define MPOL_DEFAULT 0 3662306a36Sopenharmony_ci#define MPOL_PREFERRED 1 3762306a36Sopenharmony_ci#define MPOL_BIND 2 3862306a36Sopenharmony_ci#define MPOL_INTERLEAVE 3 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci#define MPOL_MAX MPOL_INTERLEAVE 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci/* Flags for get_mem_policy */ 4362306a36Sopenharmony_ci#define MPOL_F_NODE (1<<0) /* return next il node or node of address */ 4462306a36Sopenharmony_ci /* Warning: MPOL_F_NODE is unsupported and 4562306a36Sopenharmony_ci * subject to change. Don't use. 4662306a36Sopenharmony_ci */ 4762306a36Sopenharmony_ci#define MPOL_F_ADDR (1<<1) /* look up vma using address */ 4862306a36Sopenharmony_ci#define MPOL_F_MEMS_ALLOWED (1<<2) /* query nodes allowed in cpuset */ 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci/* Flags for mbind */ 5162306a36Sopenharmony_ci#define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */ 5262306a36Sopenharmony_ci#define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to mapping */ 5362306a36Sopenharmony_ci#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */ 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci#endif /* SELFTEST_KVM_NUMAIF_H */ 56