Lines Matching refs:mempolicy

80 #include <linux/mempolicy.h>
134 static struct mempolicy default_policy = {
139 static struct mempolicy preferred_node_policy[MAX_NUMNODES];
199 struct mempolicy *get_task_policy(struct task_struct *p)
201 struct mempolicy *pol = p->mempolicy;
219 int (*create)(struct mempolicy *pol, const nodemask_t *nodes);
220 void (*rebind)(struct mempolicy *pol, const nodemask_t *nodes);
223 static inline int mpol_store_user_nodemask(const struct mempolicy *pol)
236 static int mpol_new_nodemask(struct mempolicy *pol, const nodemask_t *nodes)
244 static int mpol_new_preferred(struct mempolicy *pol, const nodemask_t *nodes)
260 * and mempolicy. May also be called holding the mmap_lock for write.
262 static int mpol_set_nodemask(struct mempolicy *pol,
299 static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags,
302 struct mempolicy *policy;
344 void __mpol_put(struct mempolicy *pol)
351 static void mpol_rebind_default(struct mempolicy *pol, const nodemask_t *nodes)
355 static void mpol_rebind_nodemask(struct mempolicy *pol, const nodemask_t *nodes)
375 static void mpol_rebind_preferred(struct mempolicy *pol,
388 static void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t *newmask)
401 * pointer, and updates task mempolicy.
407 mpol_rebind_policy(tsk->mempolicy, new);
459 static nodemask_t *policy_nodemask(gfp_t gfp, struct mempolicy *pol,
473 struct mempolicy *pol;
788 struct mempolicy *pol)
791 struct mempolicy *old;
792 struct mempolicy *new;
819 unsigned long end, struct mempolicy *new_pol)
848 struct mempolicy *new, *old;
869 old = current->mempolicy;
870 current->mempolicy = new;
889 static void get_policy_nodemask(struct mempolicy *pol, nodemask_t *nodes)
931 struct mempolicy *pol = current->mempolicy, *pol_refcount = NULL;
982 } else if (pol == current->mempolicy &&
985 } else if (pol == current->mempolicy &&
1000 * Internal mempolicy flags must be masked off before exposing
1206 * Allocate a new folio for page migration, according to NUMA mempolicy.
1212 struct mempolicy *pol = mmpol->pol;
1270 struct mempolicy *new;
1541 struct mempolicy *new, *old;
1795 struct mempolicy *__get_vma_policy(struct vm_area_struct *vma,
1812 * Falls back to current->mempolicy or system default policy, as necessary.
1818 struct mempolicy *get_vma_policy(struct vm_area_struct *vma,
1821 struct mempolicy *pol;
1836 struct mempolicy *pol;
1857 bool apply_policy_zone(struct mempolicy *policy, enum zone_type zone)
1877 static unsigned int weighted_interleave_nodes(struct mempolicy *policy)
1900 static unsigned int interleave_nodes(struct mempolicy *policy)
1922 struct mempolicy *policy;
1928 policy = current->mempolicy;
1966 static unsigned int read_once_policy_nodemask(struct mempolicy *pol,
1980 static unsigned int weighted_interleave_nid(struct mempolicy *pol, pgoff_t ilx)
2024 static unsigned int interleave_nid(struct mempolicy *pol, pgoff_t ilx)
2042 * Return a nodemask representing a mempolicy for filtering nodes for
2045 static nodemask_t *policy_nodemask(gfp_t gfp, struct mempolicy *pol,
2095 * @mpol: pointer to mempolicy pointer for reference counted mempolicy
2099 * to the struct mempolicy for conditional unref after allocation.
2101 * to the mempolicy's @nodemask for filtering the zonelist.
2104 struct mempolicy **mpol, nodemask_t **nodemask)
2118 * If the current task's mempolicy is "default" [NULL], return 'false'
2123 * of non-default mempolicy.
2125 * We don't bother with reference counting the mempolicy [mpol_get/put]
2126 * because the current task is examining it's own mempolicy and a task's
2127 * mempolicy is only ever changed by the task itself.
2133 struct mempolicy *mempolicy;
2135 if (!(mask && current->mempolicy))
2139 mempolicy = current->mempolicy;
2140 switch (mempolicy->mode) {
2146 *mask = mempolicy->nodes;
2165 * If tsk's mempolicy is "bind", check for intersection between mask and
2170 * Takes task_lock(tsk) to prevent freeing of its mempolicy.
2175 struct mempolicy *mempolicy;
2182 mempolicy = tsk->mempolicy;
2183 if (mempolicy && mempolicy->mode == MPOL_BIND)
2184 ret = nodes_intersects(mempolicy->nodes, *mask);
2212 * alloc_pages_mpol - Allocate pages according to NUMA mempolicy.
2215 * @pol: Pointer to the NUMA mempolicy.
2216 * @ilx: Index for interleave mempolicy (also distinguishes alloc_pages()).
2222 struct mempolicy *pol, pgoff_t ilx, int nid)
2299 struct mempolicy *pol;
2327 struct mempolicy *pol = &default_policy;
2330 * No reference counting needed for current->mempolicy
2348 struct mempolicy *pol, unsigned long nr_pages,
2383 struct mempolicy *pol, unsigned long nr_pages,
2498 struct mempolicy *pol, unsigned long nr_pages,
2517 /* alloc pages bulk and mempolicy should be considered at the
2526 struct mempolicy *pol = &default_policy;
2553 struct mempolicy *pol = mpol_dup(src->vm_policy);
2563 * rebinds the mempolicy its copying by calling mpol_rebind_policy()
2568 * current's mempolicy may be rebinded by the other task(the task that changes
2572 /* Slow path of a mempolicy duplicate */
2573 struct mempolicy *__mpol_dup(struct mempolicy *old)
2575 struct mempolicy *new = kmem_cache_alloc(policy_cache, GFP_KERNEL);
2580 /* task's mempolicy is protected by alloc_lock */
2581 if (old == current->mempolicy) {
2596 /* Slow path of a mempolicy comparison */
2597 bool __mpol_equal(struct mempolicy *a, struct mempolicy *b)
2694 struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
2697 struct mempolicy *pol = NULL;
2735 struct mempolicy *pol;
2830 * Drop the (possibly final) reference to task->mempolicy. It needs to be
2831 * dropped after task->mempolicy is set to NULL so that any allocation done as
2837 struct mempolicy *pol;
2840 pol = task->mempolicy;
2841 task->mempolicy = NULL;
2853 unsigned long end, struct mempolicy *pol)
2861 struct mempolicy *pol)
2864 struct mempolicy *newpol;
2887 struct mempolicy *mpol_new = NULL;
2951 * @mpol: struct mempolicy to install
2958 void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
2962 sp->root = RB_ROOT; /* empty tree == default mempolicy */
2967 struct mempolicy *npol;
2973 /* contextualize the tmpfs mount point mempolicy to this file */
2998 struct vm_area_struct *vma, struct mempolicy *pol)
3087 sizeof(struct mempolicy),
3095 preferred_node_policy[nid] = (struct mempolicy) {
3140 * Parse and format mempolicy from/to strings
3155 * mpol_parse_str - parse string to mempolicy, for tmpfs mpol mount option.
3156 * @str: string containing mempolicy to parse
3157 * @mpol: pointer to struct mempolicy pointer, returned on success.
3164 int mpol_parse_str(char *str, struct mempolicy **mpol)
3166 struct mempolicy *new = NULL;
3271 * the mempolicy in a specific context [cpuset] at a later time.
3290 * mpol_to_str - format a mempolicy structure for printing
3291 * @buffer: to contain formatted mempolicy string
3293 * @pol: pointer to mempolicy to be formatted
3299 void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)
3520 "mempolicy");
3526 pr_err("mempolicy sysfs structure failed to initialize\n");
3537 pr_err("failed to add mempolicy kobject to the system\n");