Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_MEMPOLICY_H |
| 2 | #define _LINUX_MEMPOLICY_H 1 |
| 3 | |
| 4 | #include <linux/errno.h> |
| 5 | |
| 6 | /* |
| 7 | * NUMA memory policies for Linux. |
| 8 | * Copyright 2003,2004 Andi Kleen SuSE Labs |
| 9 | */ |
| 10 | |
David Rientjes | 028fec4 | 2008-04-28 02:12:25 -0700 | [diff] [blame] | 11 | /* |
| 12 | * Both the MPOL_* mempolicy mode and the MPOL_F_* optional mode flags are |
| 13 | * passed by the user to either set_mempolicy() or mbind() in an 'int' actual. |
| 14 | * The MPOL_MODE_FLAGS macro determines the legal set of optional mode flags. |
| 15 | */ |
| 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | /* Policies */ |
David Rientjes | a3b51e0 | 2008-04-28 02:12:23 -0700 | [diff] [blame] | 18 | enum { |
| 19 | MPOL_DEFAULT, |
| 20 | MPOL_PREFERRED, |
| 21 | MPOL_BIND, |
| 22 | MPOL_INTERLEAVE, |
| 23 | MPOL_MAX, /* always last member of enum */ |
| 24 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
Miao Xie | 708c1bb | 2010-05-24 14:32:07 -0700 | [diff] [blame] | 26 | enum mpol_rebind_step { |
| 27 | MPOL_REBIND_ONCE, /* do rebind work at once(not by two step) */ |
| 28 | MPOL_REBIND_STEP1, /* first step(set all the newly nodes) */ |
| 29 | MPOL_REBIND_STEP2, /* second step(clean all the disallowed nodes)*/ |
| 30 | MPOL_REBIND_NSTEP, |
| 31 | }; |
| 32 | |
David Rientjes | 028fec4 | 2008-04-28 02:12:25 -0700 | [diff] [blame] | 33 | /* Flags for set_mempolicy */ |
David Rientjes | f5b087b | 2008-04-28 02:12:27 -0700 | [diff] [blame] | 34 | #define MPOL_F_STATIC_NODES (1 << 15) |
David Rientjes | 4c50bc0 | 2008-04-28 02:12:30 -0700 | [diff] [blame] | 35 | #define MPOL_F_RELATIVE_NODES (1 << 14) |
David Rientjes | f5b087b | 2008-04-28 02:12:27 -0700 | [diff] [blame] | 36 | |
David Rientjes | 028fec4 | 2008-04-28 02:12:25 -0700 | [diff] [blame] | 37 | /* |
| 38 | * MPOL_MODE_FLAGS is the union of all possible optional mode flags passed to |
| 39 | * either set_mempolicy() or mbind(). |
| 40 | */ |
David Rientjes | 4c50bc0 | 2008-04-28 02:12:30 -0700 | [diff] [blame] | 41 | #define MPOL_MODE_FLAGS (MPOL_F_STATIC_NODES | MPOL_F_RELATIVE_NODES) |
David Rientjes | 028fec4 | 2008-04-28 02:12:25 -0700 | [diff] [blame] | 42 | |
| 43 | /* Flags for get_mempolicy */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #define MPOL_F_NODE (1<<0) /* return next IL mode instead of node mask */ |
| 45 | #define MPOL_F_ADDR (1<<1) /* look up vma using address */ |
Lee Schermerhorn | 754af6f | 2007-10-16 01:24:51 -0700 | [diff] [blame] | 46 | #define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
| 48 | /* Flags for mbind */ |
| 49 | #define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */ |
Christoph Lameter | dc9aa5b | 2006-01-08 01:00:50 -0800 | [diff] [blame] | 50 | #define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to mapping */ |
| 51 | #define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */ |
| 52 | #define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
Lee Schermerhorn | aab0b10 | 2008-04-28 02:13:13 -0700 | [diff] [blame] | 54 | /* |
| 55 | * Internal flags that share the struct mempolicy flags word with |
| 56 | * "mode flags". These flags are allocated from bit 0 up, as they |
| 57 | * are never OR'ed into the mode in mempolicy API arguments. |
| 58 | */ |
| 59 | #define MPOL_F_SHARED (1 << 0) /* identify shared policies */ |
Lee Schermerhorn | fc36b8d | 2008-04-28 02:13:21 -0700 | [diff] [blame] | 60 | #define MPOL_F_LOCAL (1 << 1) /* preferred local allocation */ |
Miao Xie | 708c1bb | 2010-05-24 14:32:07 -0700 | [diff] [blame] | 61 | #define MPOL_F_REBINDING (1 << 2) /* identify policies in rebinding */ |
Lee Schermerhorn | aab0b10 | 2008-04-28 02:13:13 -0700 | [diff] [blame] | 62 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | #ifdef __KERNEL__ |
| 64 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | #include <linux/mmzone.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | #include <linux/slab.h> |
| 67 | #include <linux/rbtree.h> |
| 68 | #include <linux/spinlock.h> |
Andi Kleen | dfcd3c0 | 2005-10-29 18:15:48 -0700 | [diff] [blame] | 69 | #include <linux/nodemask.h> |
Gerald Schaefer | 83d1674 | 2008-07-23 21:28:22 -0700 | [diff] [blame] | 70 | #include <linux/pagemap.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | |
Ralf Baechle | 45b35a5 | 2006-06-08 00:43:41 -0700 | [diff] [blame] | 72 | struct mm_struct; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | |
| 74 | #ifdef CONFIG_NUMA |
| 75 | |
| 76 | /* |
| 77 | * Describe a memory policy. |
| 78 | * |
| 79 | * A mempolicy can be either associated with a process or with a VMA. |
| 80 | * For VMA related allocations the VMA policy is preferred, otherwise |
| 81 | * the process policy is used. Interrupts ignore the memory policy |
| 82 | * of the current process. |
| 83 | * |
| 84 | * Locking policy for interlave: |
| 85 | * In process context there is no locking because only the process accesses |
| 86 | * its own state. All vma manipulation is somewhat protected by a down_read on |
Hugh Dickins | b8072f0 | 2005-10-29 18:16:41 -0700 | [diff] [blame] | 87 | * mmap_sem. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | * |
| 89 | * Freeing policy: |
Mel Gorman | 19770b3 | 2008-04-28 02:12:18 -0700 | [diff] [blame] | 90 | * Mempolicy objects are reference counted. A mempolicy will be freed when |
Lee Schermerhorn | f0be3d3 | 2008-04-28 02:13:08 -0700 | [diff] [blame] | 91 | * mpol_put() decrements the reference count to zero. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | * |
Lee Schermerhorn | 846a16b | 2008-04-28 02:13:09 -0700 | [diff] [blame] | 93 | * Duplicating policy objects: |
| 94 | * mpol_dup() allocates a new mempolicy and copies the specified mempolicy |
Mel Gorman | 19770b3 | 2008-04-28 02:12:18 -0700 | [diff] [blame] | 95 | * to the new storage. The reference count of the new object is initialized |
Lee Schermerhorn | 846a16b | 2008-04-28 02:13:09 -0700 | [diff] [blame] | 96 | * to 1, representing the caller of mpol_dup(). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | */ |
| 98 | struct mempolicy { |
| 99 | atomic_t refcnt; |
Lee Schermerhorn | 45c4745 | 2008-04-28 02:13:12 -0700 | [diff] [blame] | 100 | unsigned short mode; /* See MPOL_* above */ |
David Rientjes | 028fec4 | 2008-04-28 02:12:25 -0700 | [diff] [blame] | 101 | unsigned short flags; /* See set_mempolicy() MPOL_F_* above */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | union { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | short preferred_node; /* preferred */ |
Mel Gorman | 19770b3 | 2008-04-28 02:12:18 -0700 | [diff] [blame] | 104 | nodemask_t nodes; /* interleave/bind */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | /* undefined for default */ |
| 106 | } v; |
David Rientjes | f5b087b | 2008-04-28 02:12:27 -0700 | [diff] [blame] | 107 | union { |
| 108 | nodemask_t cpuset_mems_allowed; /* relative to these nodes */ |
| 109 | nodemask_t user_nodemask; /* nodemask passed by user */ |
| 110 | } w; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | }; |
| 112 | |
| 113 | /* |
| 114 | * Support for managing mempolicy data objects (clone, copy, destroy) |
| 115 | * The default fast path of a NULL MPOL_DEFAULT policy is always inlined. |
| 116 | */ |
| 117 | |
Lee Schermerhorn | f0be3d3 | 2008-04-28 02:13:08 -0700 | [diff] [blame] | 118 | extern void __mpol_put(struct mempolicy *pol); |
| 119 | static inline void mpol_put(struct mempolicy *pol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | { |
| 121 | if (pol) |
Lee Schermerhorn | f0be3d3 | 2008-04-28 02:13:08 -0700 | [diff] [blame] | 122 | __mpol_put(pol); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | } |
| 124 | |
Lee Schermerhorn | 52cd3b0 | 2008-04-28 02:13:16 -0700 | [diff] [blame] | 125 | /* |
| 126 | * Does mempolicy pol need explicit unref after use? |
| 127 | * Currently only needed for shared policies. |
| 128 | */ |
| 129 | static inline int mpol_needs_cond_ref(struct mempolicy *pol) |
| 130 | { |
| 131 | return (pol && (pol->flags & MPOL_F_SHARED)); |
| 132 | } |
| 133 | |
| 134 | static inline void mpol_cond_put(struct mempolicy *pol) |
| 135 | { |
| 136 | if (mpol_needs_cond_ref(pol)) |
| 137 | __mpol_put(pol); |
| 138 | } |
| 139 | |
Lee Schermerhorn | 846a16b | 2008-04-28 02:13:09 -0700 | [diff] [blame] | 140 | extern struct mempolicy *__mpol_dup(struct mempolicy *pol); |
| 141 | static inline struct mempolicy *mpol_dup(struct mempolicy *pol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | { |
| 143 | if (pol) |
Lee Schermerhorn | 846a16b | 2008-04-28 02:13:09 -0700 | [diff] [blame] | 144 | pol = __mpol_dup(pol); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | return pol; |
| 146 | } |
| 147 | |
| 148 | #define vma_policy(vma) ((vma)->vm_policy) |
| 149 | #define vma_set_policy(vma, pol) ((vma)->vm_policy = (pol)) |
| 150 | |
| 151 | static inline void mpol_get(struct mempolicy *pol) |
| 152 | { |
| 153 | if (pol) |
| 154 | atomic_inc(&pol->refcnt); |
| 155 | } |
| 156 | |
KOSAKI Motohiro | fcfb4dc | 2012-01-10 15:08:21 -0800 | [diff] [blame] | 157 | extern bool __mpol_equal(struct mempolicy *a, struct mempolicy *b); |
| 158 | static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | { |
| 160 | if (a == b) |
KOSAKI Motohiro | fcfb4dc | 2012-01-10 15:08:21 -0800 | [diff] [blame] | 161 | return true; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | return __mpol_equal(a, b); |
| 163 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | * Tree of shared policies for a shared memory region. |
| 167 | * Maintain the policies in a pseudo mm that contains vmas. The vmas |
| 168 | * carry the policy. As a special twist the pseudo mm is indexed in pages, not |
| 169 | * bytes, so that we can work with shared memory segments bigger than |
| 170 | * unsigned long. |
| 171 | */ |
| 172 | |
| 173 | struct sp_node { |
| 174 | struct rb_node nd; |
| 175 | unsigned long start, end; |
| 176 | struct mempolicy *policy; |
| 177 | }; |
| 178 | |
| 179 | struct shared_policy { |
| 180 | struct rb_root root; |
Mel Gorman | 04a30bd | 2012-10-08 16:29:17 -0700 | [diff] [blame] | 181 | struct mutex mutex; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | }; |
| 183 | |
Lee Schermerhorn | 71fe804 | 2008-04-28 02:13:26 -0700 | [diff] [blame] | 184 | void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | int mpol_set_shared_policy(struct shared_policy *info, |
| 186 | struct vm_area_struct *vma, |
| 187 | struct mempolicy *new); |
| 188 | void mpol_free_shared_policy(struct shared_policy *p); |
| 189 | struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, |
| 190 | unsigned long idx); |
| 191 | |
Stephen Wilson | d98f6cb | 2011-05-24 17:12:41 -0700 | [diff] [blame] | 192 | struct mempolicy *get_vma_policy(struct task_struct *tsk, |
| 193 | struct vm_area_struct *vma, unsigned long addr); |
| 194 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | extern void numa_default_policy(void); |
| 196 | extern void numa_policy_init(void); |
Miao Xie | 708c1bb | 2010-05-24 14:32:07 -0700 | [diff] [blame] | 197 | extern void mpol_rebind_task(struct task_struct *tsk, const nodemask_t *new, |
| 198 | enum mpol_rebind_step step); |
Paul Jackson | 4225399 | 2006-01-08 01:01:59 -0800 | [diff] [blame] | 199 | extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); |
Paul Jackson | c61afb1 | 2006-03-24 03:16:08 -0800 | [diff] [blame] | 200 | extern void mpol_fix_fork_child_flag(struct task_struct *p); |
Paul Jackson | 4225399 | 2006-01-08 01:01:59 -0800 | [diff] [blame] | 201 | |
Christoph Lameter | 5da7ca8 | 2006-01-06 00:10:46 -0800 | [diff] [blame] | 202 | extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, |
Mel Gorman | 19770b3 | 2008-04-28 02:12:18 -0700 | [diff] [blame] | 203 | unsigned long addr, gfp_t gfp_flags, |
| 204 | struct mempolicy **mpol, nodemask_t **nodemask); |
Lee Schermerhorn | 06808b0 | 2009-12-14 17:58:21 -0800 | [diff] [blame] | 205 | extern bool init_nodemask_of_mempolicy(nodemask_t *mask); |
David Rientjes | 6f48d0eb | 2010-08-09 17:18:52 -0700 | [diff] [blame] | 206 | extern bool mempolicy_nodemask_intersects(struct task_struct *tsk, |
| 207 | const nodemask_t *mask); |
Christoph Lameter | dc85da1 | 2006-01-18 17:42:36 -0800 | [diff] [blame] | 208 | extern unsigned slab_node(struct mempolicy *policy); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | |
Christoph Lameter | 2f6726e | 2006-09-25 23:31:18 -0700 | [diff] [blame] | 210 | extern enum zone_type policy_zone; |
Christoph Lameter | 4be38e3 | 2006-01-06 00:11:17 -0800 | [diff] [blame] | 211 | |
Christoph Lameter | 2f6726e | 2006-09-25 23:31:18 -0700 | [diff] [blame] | 212 | static inline void check_highest_zone(enum zone_type k) |
Christoph Lameter | 4be38e3 | 2006-01-06 00:11:17 -0800 | [diff] [blame] | 213 | { |
Mel Gorman | b377fd3 | 2007-08-22 14:02:05 -0700 | [diff] [blame] | 214 | if (k > policy_zone && k != ZONE_MOVABLE) |
Christoph Lameter | 4be38e3 | 2006-01-06 00:11:17 -0800 | [diff] [blame] | 215 | policy_zone = k; |
| 216 | } |
| 217 | |
Christoph Lameter | 3974388 | 2006-01-08 01:00:51 -0800 | [diff] [blame] | 218 | int do_migrate_pages(struct mm_struct *mm, |
| 219 | const nodemask_t *from_nodes, const nodemask_t *to_nodes, int flags); |
| 220 | |
Lee Schermerhorn | 095f1fc | 2008-04-28 02:13:23 -0700 | [diff] [blame] | 221 | |
| 222 | #ifdef CONFIG_TMPFS |
Lee Schermerhorn | 71fe804 | 2008-04-28 02:13:26 -0700 | [diff] [blame] | 223 | extern int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context); |
Stephen Wilson | 13057ef | 2011-05-24 17:12:46 -0700 | [diff] [blame] | 224 | #endif |
Lee Schermerhorn | 095f1fc | 2008-04-28 02:13:23 -0700 | [diff] [blame] | 225 | |
Lee Schermerhorn | 71fe804 | 2008-04-28 02:13:26 -0700 | [diff] [blame] | 226 | extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, |
| 227 | int no_context); |
Gerald Schaefer | 83d1674 | 2008-07-23 21:28:22 -0700 | [diff] [blame] | 228 | |
| 229 | /* Check if a vma is migratable */ |
| 230 | static inline int vma_migratable(struct vm_area_struct *vma) |
| 231 | { |
| 232 | if (vma->vm_flags & (VM_IO|VM_HUGETLB|VM_PFNMAP|VM_RESERVED)) |
| 233 | return 0; |
| 234 | /* |
| 235 | * Migration allocates pages in the highest zone. If we cannot |
| 236 | * do so then migration (at least from node to node) is not |
| 237 | * possible. |
| 238 | */ |
| 239 | if (vma->vm_file && |
| 240 | gfp_zone(mapping_gfp_mask(vma->vm_file->f_mapping)) |
| 241 | < policy_zone) |
| 242 | return 0; |
| 243 | return 1; |
| 244 | } |
| 245 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | #else |
| 247 | |
| 248 | struct mempolicy {}; |
| 249 | |
KOSAKI Motohiro | fcfb4dc | 2012-01-10 15:08:21 -0800 | [diff] [blame] | 250 | static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | { |
KOSAKI Motohiro | fcfb4dc | 2012-01-10 15:08:21 -0800 | [diff] [blame] | 252 | return true; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | |
Lee Schermerhorn | f0be3d3 | 2008-04-28 02:13:08 -0700 | [diff] [blame] | 255 | static inline void mpol_put(struct mempolicy *p) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | { |
| 257 | } |
| 258 | |
Lee Schermerhorn | 52cd3b0 | 2008-04-28 02:13:16 -0700 | [diff] [blame] | 259 | static inline void mpol_cond_put(struct mempolicy *pol) |
| 260 | { |
| 261 | } |
| 262 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | static inline void mpol_get(struct mempolicy *pol) |
| 264 | { |
| 265 | } |
| 266 | |
Lee Schermerhorn | 846a16b | 2008-04-28 02:13:09 -0700 | [diff] [blame] | 267 | static inline struct mempolicy *mpol_dup(struct mempolicy *old) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | { |
| 269 | return NULL; |
| 270 | } |
| 271 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | struct shared_policy {}; |
| 273 | |
| 274 | static inline int mpol_set_shared_policy(struct shared_policy *info, |
| 275 | struct vm_area_struct *vma, |
| 276 | struct mempolicy *new) |
| 277 | { |
| 278 | return -EINVAL; |
| 279 | } |
| 280 | |
Lee Schermerhorn | 71fe804 | 2008-04-28 02:13:26 -0700 | [diff] [blame] | 281 | static inline void mpol_shared_policy_init(struct shared_policy *sp, |
| 282 | struct mempolicy *mpol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | { |
| 284 | } |
| 285 | |
| 286 | static inline void mpol_free_shared_policy(struct shared_policy *p) |
| 287 | { |
| 288 | } |
| 289 | |
| 290 | static inline struct mempolicy * |
| 291 | mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx) |
| 292 | { |
| 293 | return NULL; |
| 294 | } |
| 295 | |
| 296 | #define vma_policy(vma) NULL |
| 297 | #define vma_set_policy(vma, pol) do {} while(0) |
| 298 | |
| 299 | static inline void numa_policy_init(void) |
| 300 | { |
| 301 | } |
| 302 | |
| 303 | static inline void numa_default_policy(void) |
| 304 | { |
| 305 | } |
| 306 | |
Paul Jackson | 74cb215 | 2006-01-08 01:01:56 -0800 | [diff] [blame] | 307 | static inline void mpol_rebind_task(struct task_struct *tsk, |
Miao Xie | 708c1bb | 2010-05-24 14:32:07 -0700 | [diff] [blame] | 308 | const nodemask_t *new, |
| 309 | enum mpol_rebind_step step) |
Paul Jackson | 68860ec | 2005-10-30 15:02:36 -0800 | [diff] [blame] | 310 | { |
| 311 | } |
| 312 | |
Paul Jackson | 4225399 | 2006-01-08 01:01:59 -0800 | [diff] [blame] | 313 | static inline void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new) |
| 314 | { |
| 315 | } |
| 316 | |
Paul Jackson | c61afb1 | 2006-03-24 03:16:08 -0800 | [diff] [blame] | 317 | static inline void mpol_fix_fork_child_flag(struct task_struct *p) |
| 318 | { |
| 319 | } |
| 320 | |
Christoph Lameter | 5da7ca8 | 2006-01-06 00:10:46 -0800 | [diff] [blame] | 321 | static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, |
Mel Gorman | 19770b3 | 2008-04-28 02:12:18 -0700 | [diff] [blame] | 322 | unsigned long addr, gfp_t gfp_flags, |
| 323 | struct mempolicy **mpol, nodemask_t **nodemask) |
Christoph Lameter | 5da7ca8 | 2006-01-06 00:10:46 -0800 | [diff] [blame] | 324 | { |
Mel Gorman | 19770b3 | 2008-04-28 02:12:18 -0700 | [diff] [blame] | 325 | *mpol = NULL; |
| 326 | *nodemask = NULL; |
Mel Gorman | 0e88460 | 2008-04-28 02:12:14 -0700 | [diff] [blame] | 327 | return node_zonelist(0, gfp_flags); |
Christoph Lameter | 5da7ca8 | 2006-01-06 00:10:46 -0800 | [diff] [blame] | 328 | } |
| 329 | |
David Rientjes | 6f48d0eb | 2010-08-09 17:18:52 -0700 | [diff] [blame] | 330 | static inline bool init_nodemask_of_mempolicy(nodemask_t *m) |
| 331 | { |
| 332 | return false; |
| 333 | } |
| 334 | |
| 335 | static inline bool mempolicy_nodemask_intersects(struct task_struct *tsk, |
| 336 | const nodemask_t *mask) |
| 337 | { |
| 338 | return false; |
| 339 | } |
Lee Schermerhorn | 06808b0 | 2009-12-14 17:58:21 -0800 | [diff] [blame] | 340 | |
Paul Jackson | 45b07ef | 2006-01-08 01:00:56 -0800 | [diff] [blame] | 341 | static inline int do_migrate_pages(struct mm_struct *mm, |
| 342 | const nodemask_t *from_nodes, |
| 343 | const nodemask_t *to_nodes, int flags) |
| 344 | { |
| 345 | return 0; |
| 346 | } |
| 347 | |
Christoph Lameter | 4be38e3 | 2006-01-06 00:11:17 -0800 | [diff] [blame] | 348 | static inline void check_highest_zone(int k) |
| 349 | { |
| 350 | } |
Lee Schermerhorn | 095f1fc | 2008-04-28 02:13:23 -0700 | [diff] [blame] | 351 | |
| 352 | #ifdef CONFIG_TMPFS |
Lee Schermerhorn | 71fe804 | 2008-04-28 02:13:26 -0700 | [diff] [blame] | 353 | static inline int mpol_parse_str(char *str, struct mempolicy **mpol, |
| 354 | int no_context) |
Lee Schermerhorn | 095f1fc | 2008-04-28 02:13:23 -0700 | [diff] [blame] | 355 | { |
Lee Schermerhorn | 71fe804 | 2008-04-28 02:13:26 -0700 | [diff] [blame] | 356 | return 1; /* error */ |
Lee Schermerhorn | 095f1fc | 2008-04-28 02:13:23 -0700 | [diff] [blame] | 357 | } |
Stephen Wilson | 13057ef | 2011-05-24 17:12:46 -0700 | [diff] [blame] | 358 | #endif |
Lee Schermerhorn | 095f1fc | 2008-04-28 02:13:23 -0700 | [diff] [blame] | 359 | |
Lee Schermerhorn | 71fe804 | 2008-04-28 02:13:26 -0700 | [diff] [blame] | 360 | static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, |
| 361 | int no_context) |
Lee Schermerhorn | 095f1fc | 2008-04-28 02:13:23 -0700 | [diff] [blame] | 362 | { |
| 363 | return 0; |
| 364 | } |
Lee Schermerhorn | 095f1fc | 2008-04-28 02:13:23 -0700 | [diff] [blame] | 365 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | #endif /* CONFIG_NUMA */ |
| 367 | #endif /* __KERNEL__ */ |
| 368 | |
| 369 | #endif |