16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2607ca46eSDavid Howells /* 3607ca46eSDavid Howells * NUMA memory policies for Linux. 4607ca46eSDavid Howells * Copyright 2003,2004 Andi Kleen SuSE Labs 5607ca46eSDavid Howells */ 6607ca46eSDavid Howells #ifndef _UAPI_LINUX_MEMPOLICY_H 7607ca46eSDavid Howells #define _UAPI_LINUX_MEMPOLICY_H 8607ca46eSDavid Howells 9607ca46eSDavid Howells #include <linux/errno.h> 10607ca46eSDavid Howells 11607ca46eSDavid Howells 12607ca46eSDavid Howells /* 13607ca46eSDavid Howells * Both the MPOL_* mempolicy mode and the MPOL_F_* optional mode flags are 14607ca46eSDavid Howells * passed by the user to either set_mempolicy() or mbind() in an 'int' actual. 15607ca46eSDavid Howells * The MPOL_MODE_FLAGS macro determines the legal set of optional mode flags. 16607ca46eSDavid Howells */ 17607ca46eSDavid Howells 18607ca46eSDavid Howells /* Policies */ 19607ca46eSDavid Howells enum { 20607ca46eSDavid Howells MPOL_DEFAULT, 21607ca46eSDavid Howells MPOL_PREFERRED, 22607ca46eSDavid Howells MPOL_BIND, 23607ca46eSDavid Howells MPOL_INTERLEAVE, 24479e2802SPeter Zijlstra MPOL_LOCAL, 25*b27abaccSDave Hansen MPOL_PREFERRED_MANY, 26607ca46eSDavid Howells MPOL_MAX, /* always last member of enum */ 27607ca46eSDavid Howells }; 28607ca46eSDavid Howells 29607ca46eSDavid Howells /* Flags for set_mempolicy */ 30607ca46eSDavid Howells #define MPOL_F_STATIC_NODES (1 << 15) 31607ca46eSDavid Howells #define MPOL_F_RELATIVE_NODES (1 << 14) 32bda420b9SHuang Ying #define MPOL_F_NUMA_BALANCING (1 << 13) /* Optimize with NUMA balancing if possible */ 33607ca46eSDavid Howells 34607ca46eSDavid Howells /* 35607ca46eSDavid Howells * MPOL_MODE_FLAGS is the union of all possible optional mode flags passed to 36607ca46eSDavid Howells * either set_mempolicy() or mbind(). 37607ca46eSDavid Howells */ 38bda420b9SHuang Ying #define MPOL_MODE_FLAGS \ 39bda420b9SHuang Ying (MPOL_F_STATIC_NODES | MPOL_F_RELATIVE_NODES | MPOL_F_NUMA_BALANCING) 40607ca46eSDavid Howells 41607ca46eSDavid Howells /* Flags for get_mempolicy */ 42607ca46eSDavid Howells #define MPOL_F_NODE (1<<0) /* return next IL mode instead of node mask */ 43607ca46eSDavid Howells #define MPOL_F_ADDR (1<<1) /* look up vma using address */ 44607ca46eSDavid Howells #define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */ 45607ca46eSDavid Howells 46607ca46eSDavid Howells /* Flags for mbind */ 47607ca46eSDavid Howells #define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */ 48b24f53a0SLee Schermerhorn #define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform 49b24f53a0SLee Schermerhorn to policy */ 50b24f53a0SLee Schermerhorn #define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to policy */ 51b24f53a0SLee Schermerhorn #define MPOL_MF_LAZY (1<<3) /* Modifies '_MOVE: lazy migrate on fault */ 52b24f53a0SLee Schermerhorn #define MPOL_MF_INTERNAL (1<<4) /* Internal flags start here */ 53b24f53a0SLee Schermerhorn 54b24f53a0SLee Schermerhorn #define MPOL_MF_VALID (MPOL_MF_STRICT | \ 55b24f53a0SLee Schermerhorn MPOL_MF_MOVE | \ 56a720094dSMel Gorman MPOL_MF_MOVE_ALL) 57607ca46eSDavid Howells 58607ca46eSDavid Howells /* 59607ca46eSDavid Howells * Internal flags that share the struct mempolicy flags word with 60607ca46eSDavid Howells * "mode flags". These flags are allocated from bit 0 up, as they 61607ca46eSDavid Howells * are never OR'ed into the mode in mempolicy API arguments. 62607ca46eSDavid Howells */ 63607ca46eSDavid Howells #define MPOL_F_SHARED (1 << 0) /* identify shared policies */ 64771fb4d8SLee Schermerhorn #define MPOL_F_MOF (1 << 3) /* this policy wants migrate on fault */ 658a0516edSMel Gorman #define MPOL_F_MORON (1 << 4) /* Migrate On protnone Reference On Node */ 66607ca46eSDavid Howells 67b6676de8SDave Hansen /* 68b6676de8SDave Hansen * These bit locations are exposed in the vm.zone_reclaim_mode sysctl 69b6676de8SDave Hansen * ABI. New bits are OK, but existing bits can never change. 70b6676de8SDave Hansen */ 71b6676de8SDave Hansen #define RECLAIM_ZONE (1<<0) /* Run shrink_inactive_list on the zone */ 72b6676de8SDave Hansen #define RECLAIM_WRITE (1<<1) /* Writeout pages during reclaim */ 73b6676de8SDave Hansen #define RECLAIM_UNMAP (1<<2) /* Unmap pages during reclaim */ 74607ca46eSDavid Howells 75607ca46eSDavid Howells #endif /* _UAPI_LINUX_MEMPOLICY_H */ 76