Lines Matching refs:pol

160 	struct mempolicy *pol = p->mempolicy;  in get_task_policy()  local
163 if (pol) in get_task_policy()
164 return pol; in get_task_policy()
168 pol = &preferred_node_policy[node]; in get_task_policy()
170 if (pol->mode) in get_task_policy()
171 return pol; in get_task_policy()
178 int (*create)(struct mempolicy *pol, const nodemask_t *nodes);
179 void (*rebind)(struct mempolicy *pol, const nodemask_t *nodes);
182 static inline int mpol_store_user_nodemask(const struct mempolicy *pol) in mpol_store_user_nodemask() argument
184 return pol->flags & MPOL_MODE_FLAGS; in mpol_store_user_nodemask()
195 static int mpol_new_nodemask(struct mempolicy *pol, const nodemask_t *nodes) in mpol_new_nodemask() argument
199 pol->nodes = *nodes; in mpol_new_nodemask()
203 static int mpol_new_preferred(struct mempolicy *pol, const nodemask_t *nodes) in mpol_new_preferred() argument
208 nodes_clear(pol->nodes); in mpol_new_preferred()
209 node_set(first_node(*nodes), pol->nodes); in mpol_new_preferred()
221 static int mpol_set_nodemask(struct mempolicy *pol, in mpol_set_nodemask() argument
231 if (!pol || pol->mode == MPOL_LOCAL) in mpol_set_nodemask()
240 if (pol->flags & MPOL_F_RELATIVE_NODES) in mpol_set_nodemask()
245 if (mpol_store_user_nodemask(pol)) in mpol_set_nodemask()
246 pol->w.user_nodemask = *nodes; in mpol_set_nodemask()
248 pol->w.cpuset_mems_allowed = cpuset_current_mems_allowed; in mpol_set_nodemask()
250 ret = mpol_ops[pol->mode].create(pol, &nsc->mask2); in mpol_set_nodemask()
311 static void mpol_rebind_default(struct mempolicy *pol, const nodemask_t *nodes) in mpol_rebind_default() argument
315 static void mpol_rebind_nodemask(struct mempolicy *pol, const nodemask_t *nodes) in mpol_rebind_nodemask() argument
319 if (pol->flags & MPOL_F_STATIC_NODES) in mpol_rebind_nodemask()
320 nodes_and(tmp, pol->w.user_nodemask, *nodes); in mpol_rebind_nodemask()
321 else if (pol->flags & MPOL_F_RELATIVE_NODES) in mpol_rebind_nodemask()
322 mpol_relative_nodemask(&tmp, &pol->w.user_nodemask, nodes); in mpol_rebind_nodemask()
324 nodes_remap(tmp, pol->nodes, pol->w.cpuset_mems_allowed, in mpol_rebind_nodemask()
326 pol->w.cpuset_mems_allowed = *nodes; in mpol_rebind_nodemask()
332 pol->nodes = tmp; in mpol_rebind_nodemask()
335 static void mpol_rebind_preferred(struct mempolicy *pol, in mpol_rebind_preferred() argument
338 pol->w.cpuset_mems_allowed = *nodes; in mpol_rebind_preferred()
348 static void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t *newmask) in mpol_rebind_policy() argument
350 if (!pol) in mpol_rebind_policy()
352 if (!mpol_store_user_nodemask(pol) && in mpol_rebind_policy()
353 nodes_equal(pol->w.cpuset_mems_allowed, *newmask)) in mpol_rebind_policy()
356 mpol_ops[pol->mode].rebind(pol, newmask); in mpol_rebind_policy()
751 struct mempolicy *pol) in vma_replace_policy() argument
762 new = mpol_dup(pol); in vma_replace_policy()
926 struct mempolicy *pol = current->mempolicy, *pol_refcount = NULL; in do_get_mempolicy() local
955 pol = vma->vm_ops->get_policy(vma, addr); in do_get_mempolicy()
957 pol = vma->vm_policy; in do_get_mempolicy()
961 if (!pol) in do_get_mempolicy()
962 pol = &default_policy; /* indicates default behavior */ in do_get_mempolicy()
972 pol_refcount = pol; in do_get_mempolicy()
974 mpol_get(pol); in do_get_mempolicy()
979 } else if (pol == current->mempolicy && in do_get_mempolicy()
980 pol->mode == MPOL_INTERLEAVE) { in do_get_mempolicy()
981 *policy = next_node_in(current->il_prev, pol->nodes); in do_get_mempolicy()
987 *policy = pol == &default_policy ? MPOL_DEFAULT : in do_get_mempolicy()
988 pol->mode; in do_get_mempolicy()
993 *policy |= (pol->flags & MPOL_MODE_FLAGS); in do_get_mempolicy()
998 if (mpol_store_user_nodemask(pol)) { in do_get_mempolicy()
999 *nmask = pol->w.user_nodemask; in do_get_mempolicy()
1002 get_policy_nodemask(pol, nmask); in do_get_mempolicy()
1008 mpol_cond_put(pol); in do_get_mempolicy()
1677 struct mempolicy *pol = NULL; in __get_vma_policy() local
1681 pol = vma->vm_ops->get_policy(vma, addr); in __get_vma_policy()
1683 pol = vma->vm_policy; in __get_vma_policy()
1691 if (mpol_needs_cond_ref(pol)) in __get_vma_policy()
1692 mpol_get(pol); in __get_vma_policy()
1696 return pol; in __get_vma_policy()
1714 struct mempolicy *pol = __get_vma_policy(vma, addr); in get_vma_policy() local
1716 if (!pol) in get_vma_policy()
1717 pol = get_task_policy(current); in get_vma_policy()
1719 return pol; in get_vma_policy()
1724 struct mempolicy *pol; in vma_policy_mof() local
1729 pol = vma->vm_ops->get_policy(vma, vma->vm_start); in vma_policy_mof()
1730 if (pol && (pol->flags & MPOL_F_MOF)) in vma_policy_mof()
1732 mpol_cond_put(pol); in vma_policy_mof()
1737 pol = vma->vm_policy; in vma_policy_mof()
1738 if (!pol) in vma_policy_mof()
1739 pol = get_task_policy(current); in vma_policy_mof()
1741 return pol->flags & MPOL_F_MOF; in vma_policy_mof()
1871 static unsigned offset_il_node(struct mempolicy *pol, unsigned long n) in offset_il_node() argument
1873 nodemask_t nodemask = pol->nodes; in offset_il_node()
1897 static inline unsigned interleave_nid(struct mempolicy *pol, in interleave_nid() argument
1913 return offset_il_node(pol, off); in interleave_nid()
1915 return interleave_nodes(pol); in interleave_nid()
2049 int nid, struct mempolicy *pol) in alloc_pages_preferred_many() argument
2062 page = __alloc_pages(preferred_gfp, order, nid, &pol->nodes); in alloc_pages_preferred_many()
2088 struct mempolicy *pol; in alloc_pages_vma() local
2093 pol = get_vma_policy(vma, addr); in alloc_pages_vma()
2095 if (pol->mode == MPOL_INTERLEAVE) { in alloc_pages_vma()
2098 nid = interleave_nid(pol, vma, addr, PAGE_SHIFT + order); in alloc_pages_vma()
2099 mpol_cond_put(pol); in alloc_pages_vma()
2104 if (pol->mode == MPOL_PREFERRED_MANY) { in alloc_pages_vma()
2105 page = alloc_pages_preferred_many(gfp, order, node, pol); in alloc_pages_vma()
2106 mpol_cond_put(pol); in alloc_pages_vma()
2123 if (pol->mode == MPOL_PREFERRED) in alloc_pages_vma()
2124 hpage_node = first_node(pol->nodes); in alloc_pages_vma()
2126 nmask = policy_nodemask(gfp, pol); in alloc_pages_vma()
2128 mpol_cond_put(pol); in alloc_pages_vma()
2149 nmask = policy_nodemask(gfp, pol); in alloc_pages_vma()
2150 preferred_nid = policy_node(gfp, pol, node); in alloc_pages_vma()
2152 mpol_cond_put(pol); in alloc_pages_vma()
2174 struct mempolicy *pol = &default_policy; in alloc_pages() local
2178 pol = get_task_policy(current); in alloc_pages()
2184 if (pol->mode == MPOL_INTERLEAVE) in alloc_pages()
2185 page = alloc_page_interleave(gfp, order, interleave_nodes(pol)); in alloc_pages()
2186 else if (pol->mode == MPOL_PREFERRED_MANY) in alloc_pages()
2188 numa_node_id(), pol); in alloc_pages()
2191 policy_node(gfp, pol, numa_node_id()), in alloc_pages()
2192 policy_nodemask(gfp, pol)); in alloc_pages()
2209 struct mempolicy *pol, unsigned long nr_pages, in alloc_pages_bulk_array_interleave() argument
2219 nodes = nodes_weight(pol->nodes); in alloc_pages_bulk_array_interleave()
2226 interleave_nodes(pol), NULL, in alloc_pages_bulk_array_interleave()
2232 interleave_nodes(pol), NULL, in alloc_pages_bulk_array_interleave()
2244 struct mempolicy *pol, unsigned long nr_pages, in alloc_pages_bulk_array_preferred_many() argument
2253 nr_allocated = __alloc_pages_bulk(preferred_gfp, nid, &pol->nodes, in alloc_pages_bulk_array_preferred_many()
2272 struct mempolicy *pol = &default_policy; in alloc_pages_bulk_array_mempolicy() local
2275 pol = get_task_policy(current); in alloc_pages_bulk_array_mempolicy()
2277 if (pol->mode == MPOL_INTERLEAVE) in alloc_pages_bulk_array_mempolicy()
2278 return alloc_pages_bulk_array_interleave(gfp, pol, in alloc_pages_bulk_array_mempolicy()
2281 if (pol->mode == MPOL_PREFERRED_MANY) in alloc_pages_bulk_array_mempolicy()
2283 numa_node_id(), pol, nr_pages, page_array); in alloc_pages_bulk_array_mempolicy()
2285 return __alloc_pages_bulk(gfp, policy_node(gfp, pol, numa_node_id()), in alloc_pages_bulk_array_mempolicy()
2286 policy_nodemask(gfp, pol), nr_pages, NULL, in alloc_pages_bulk_array_mempolicy()
2292 struct mempolicy *pol = mpol_dup(vma_policy(src)); in vma_dup_policy() local
2294 if (IS_ERR(pol)) in vma_dup_policy()
2295 return PTR_ERR(pol); in vma_dup_policy()
2296 dst->vm_policy = pol; in vma_dup_policy()
2435 struct mempolicy *pol = NULL; in mpol_shared_policy_lookup() local
2444 pol = sn->policy; in mpol_shared_policy_lookup()
2447 return pol; in mpol_shared_policy_lookup()
2472 struct mempolicy *pol; in mpol_misplaced() local
2481 pol = get_vma_policy(vma, addr); in mpol_misplaced()
2482 if (!(pol->flags & MPOL_F_MOF)) in mpol_misplaced()
2485 switch (pol->mode) { in mpol_misplaced()
2489 polnid = offset_il_node(pol, pgoff); in mpol_misplaced()
2493 if (node_isset(curnid, pol->nodes)) in mpol_misplaced()
2495 polnid = first_node(pol->nodes); in mpol_misplaced()
2504 if (pol->flags & MPOL_F_MORON) { in mpol_misplaced()
2505 if (node_isset(thisnid, pol->nodes)) in mpol_misplaced()
2517 if (node_isset(curnid, pol->nodes)) in mpol_misplaced()
2522 &pol->nodes); in mpol_misplaced()
2531 if (pol->flags & MPOL_F_MORON) { in mpol_misplaced()
2541 mpol_cond_put(pol); in mpol_misplaced()
2554 struct mempolicy *pol; in mpol_put_task_policy() local
2557 pol = task->mempolicy; in mpol_put_task_policy()
2560 mpol_put(pol); in mpol_put_task_policy()
2571 unsigned long end, struct mempolicy *pol) in sp_node_init() argument
2575 node->policy = pol; in sp_node_init()
2579 struct mempolicy *pol) in sp_alloc() argument
2588 newpol = mpol_dup(pol); in sp_alloc()
3023 void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol) in mpol_to_str() argument
3030 if (pol && pol != &default_policy && !(pol->flags & MPOL_F_MORON)) { in mpol_to_str()
3031 mode = pol->mode; in mpol_to_str()
3032 flags = pol->flags; in mpol_to_str()
3043 nodes = pol->nodes; in mpol_to_str()