Lines Matching defs:mempolicy
70 #include <linux/mempolicy.h>
122 static struct mempolicy default_policy = {
128 static struct mempolicy preferred_node_policy[MAX_NUMNODES];
156 struct mempolicy *get_task_policy(struct task_struct *p)
158 struct mempolicy *pol = p->mempolicy;
176 int (*create)(struct mempolicy *pol, const nodemask_t *nodes);
177 void (*rebind)(struct mempolicy *pol, const nodemask_t *nodes);
180 static inline int mpol_store_user_nodemask(const struct mempolicy *pol)
193 static int mpol_new_interleave(struct mempolicy *pol, const nodemask_t *nodes)
201 static int mpol_new_preferred(struct mempolicy *pol, const nodemask_t *nodes)
212 static int mpol_new_bind(struct mempolicy *pol, const nodemask_t *nodes)
227 * and mempolicy. May also be called holding the mmap_lock for write.
229 static int mpol_set_nodemask(struct mempolicy *pol,
268 static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags,
271 struct mempolicy *policy;
313 void __mpol_put(struct mempolicy *p)
320 static void mpol_rebind_default(struct mempolicy *pol, const nodemask_t *nodes)
324 static void mpol_rebind_nodemask(struct mempolicy *pol, const nodemask_t *nodes)
344 static void mpol_rebind_preferred(struct mempolicy *pol,
375 static void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t *newmask)
388 * pointer, and updates task mempolicy.
395 mpol_rebind_policy(tsk->mempolicy, new);
771 struct mempolicy *pol)
774 struct mempolicy *old;
775 struct mempolicy *new;
804 unsigned long end, struct mempolicy *new_pol)
861 struct mempolicy *new, *old;
880 old = current->mempolicy;
881 current->mempolicy = new;
897 static void get_policy_nodemask(struct mempolicy *p, nodemask_t *nodes)
941 struct mempolicy *pol = current->mempolicy, *pol_refcount = NULL;
994 } else if (pol == current->mempolicy &&
1005 * Internal mempolicy flags must be masked off before exposing
1269 struct mempolicy *new;
1775 struct mempolicy *__get_vma_policy(struct vm_area_struct *vma,
1778 struct mempolicy *pol = NULL;
1806 * Falls back to current->mempolicy or system default policy, as necessary.
1812 static struct mempolicy *get_vma_policy(struct vm_area_struct *vma,
1815 struct mempolicy *pol = __get_vma_policy(vma, addr);
1825 struct mempolicy *pol;
1845 static int apply_policy_zone(struct mempolicy *policy, enum zone_type zone)
1866 * Return a nodemask representing a mempolicy for filtering nodes for
1869 nodemask_t *policy_nodemask(gfp_t gfp, struct mempolicy *policy)
1880 /* Return the node id preferred by the given mempolicy, or the given id */
1881 static int policy_node(gfp_t gfp, struct mempolicy *policy, int nd)
1898 static unsigned interleave_nodes(struct mempolicy *policy)
1915 struct mempolicy *policy;
1921 policy = current->mempolicy;
1960 static unsigned offset_il_node(struct mempolicy *pol, unsigned long n)
1977 static inline unsigned interleave_nid(struct mempolicy *pol,
2004 * @mpol: pointer to mempolicy pointer for reference counted mempolicy
2008 * to the struct mempolicy for conditional unref after allocation.
2009 * If the effective policy is 'BIND, returns a pointer to the mempolicy's
2015 struct mempolicy **mpol, nodemask_t **nodemask)
2036 * If the current task's mempolicy is "default" [NULL], return 'false'
2041 * of non-default mempolicy.
2043 * We don't bother with reference counting the mempolicy [mpol_get/put]
2044 * because the current task is examining it's own mempolicy and a task's
2045 * mempolicy is only ever changed by the task itself.
2051 struct mempolicy *mempolicy;
2054 if (!(mask && current->mempolicy))
2058 mempolicy = current->mempolicy;
2059 switch (mempolicy->mode) {
2061 if (mempolicy->flags & MPOL_F_LOCAL)
2064 nid = mempolicy->v.preferred_node;
2070 *mask = mempolicy->v.nodes;
2085 * If tsk's mempolicy is "default" [NULL], return 'true' to indicate default
2090 * Takes task_lock(tsk) to prevent freeing of its mempolicy.
2095 struct mempolicy *mempolicy;
2101 mempolicy = tsk->mempolicy;
2102 if (!mempolicy)
2105 switch (mempolicy->mode) {
2116 ret = nodes_intersects(mempolicy->v.nodes, *mask);
2172 struct mempolicy *pol;
2254 struct mempolicy *pol = &default_policy;
2261 * No reference counting needed for current->mempolicy
2277 struct mempolicy *pol = mpol_dup(vma_policy(src));
2287 * rebinds the mempolicy its copying by calling mpol_rebind_policy()
2292 * current's mempolicy may be rebinded by the other task(the task that changes
2296 /* Slow path of a mempolicy duplicate */
2297 struct mempolicy *__mpol_dup(struct mempolicy *old)
2299 struct mempolicy *new = kmem_cache_alloc(policy_cache, GFP_KERNEL);
2304 /* task's mempolicy is protected by alloc_lock */
2305 if (old == current->mempolicy) {
2320 /* Slow path of a mempolicy comparison */
2321 bool __mpol_equal(struct mempolicy *a, struct mempolicy *b)
2418 struct mempolicy *
2421 struct mempolicy *pol = NULL;
2461 struct mempolicy *pol;
2526 * Drop the (possibly final) reference to task->mempolicy. It needs to be
2527 * dropped after task->mempolicy is set to NULL so that any allocation done as
2533 struct mempolicy *pol;
2536 pol = task->mempolicy;
2537 task->mempolicy = NULL;
2550 unsigned long end, struct mempolicy *pol)
2558 struct mempolicy *pol)
2561 struct mempolicy *newpol;
2584 struct mempolicy *mpol_new = NULL;
2648 * @mpol: struct mempolicy to install
2655 void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
2659 sp->root = RB_ROOT; /* empty tree == default mempolicy */
2664 struct mempolicy *new;
2669 /* contextualize the tmpfs mount point mempolicy */
2695 struct vm_area_struct *vma, struct mempolicy *npol)
2791 sizeof(struct mempolicy),
2799 preferred_node_policy[nid] = (struct mempolicy) {
2844 * Parse and format mempolicy from/to strings
2862 * mpol_parse_str - parse string to mempolicy, for tmpfs mpol mount option.
2863 * @str: string containing mempolicy to parse
2864 * @mpol: pointer to struct mempolicy pointer, returned on success.
2871 int mpol_parse_str(char *str, struct mempolicy **mpol)
2873 struct mempolicy *new = NULL;
2975 * the mempolicy in a specific context [cpuset] at a later time.
2994 * mpol_to_str - format a mempolicy structure for printing
2995 * @buffer: to contain formatted mempolicy string
2997 * @pol: pointer to mempolicy to be formatted
3003 void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)