Lines Matching refs:policy
271 struct mempolicy *policy; in mpol_new() local
302 policy = kmem_cache_alloc(policy_cache, GFP_KERNEL); in mpol_new()
303 if (!policy) in mpol_new()
305 atomic_set(&policy->refcnt, 1); in mpol_new()
306 policy->mode = mode; in mpol_new()
307 policy->flags = flags; in mpol_new()
309 return policy; in mpol_new()
945 static long do_get_mempolicy(int *policy, nodemask_t *nmask, in do_get_mempolicy() argument
960 *policy = 0; /* just so it's initialized */ in do_get_mempolicy()
1003 *policy = err; in do_get_mempolicy()
1006 *policy = next_node_in(current->il_prev, pol->v.nodes); in do_get_mempolicy()
1012 *policy = pol == &default_policy ? MPOL_DEFAULT : in do_get_mempolicy()
1018 *policy |= (pol->flags & MPOL_MODE_FLAGS); in do_get_mempolicy()
1611 static int kernel_get_mempolicy(int __user *policy, in kernel_get_mempolicy() argument
1631 if (policy && put_user(pval, policy)) in kernel_get_mempolicy()
1640 SYSCALL_DEFINE5(get_mempolicy, int __user *, policy, in SYSCALL_DEFINE5() argument
1644 return kernel_get_mempolicy(policy, nmask, maxnode, addr, flags); in SYSCALL_DEFINE5()
1649 COMPAT_SYSCALL_DEFINE5(get_mempolicy, int __user *, policy, in COMPAT_SYSCALL_DEFINE5() argument
1665 err = kernel_get_mempolicy(policy, nm, nr_bits+1, addr, flags); in COMPAT_SYSCALL_DEFINE5()
1860 static int apply_policy_zone(struct mempolicy *policy, enum zone_type zone) in apply_policy_zone() argument
1874 if (!nodes_intersects(policy->v.nodes, node_states[N_HIGH_MEMORY])) in apply_policy_zone()
1884 nodemask_t *policy_nodemask(gfp_t gfp, struct mempolicy *policy) in policy_nodemask() argument
1887 if (unlikely(policy->mode == MPOL_BIND) && in policy_nodemask()
1888 apply_policy_zone(policy, gfp_zone(gfp)) && in policy_nodemask()
1889 cpuset_nodemask_valid_mems_allowed(&policy->v.nodes)) in policy_nodemask()
1890 return &policy->v.nodes; in policy_nodemask()
1896 static int policy_node(gfp_t gfp, struct mempolicy *policy, int nd) in policy_node() argument
1898 if (policy->mode == MPOL_PREFERRED && !(policy->flags & MPOL_F_LOCAL)) in policy_node()
1899 nd = policy->v.preferred_node; in policy_node()
1906 WARN_ON_ONCE(policy->mode == MPOL_BIND && (gfp & __GFP_THISNODE)); in policy_node()
1913 static unsigned interleave_nodes(struct mempolicy *policy) in interleave_nodes() argument
1918 next = next_node_in(me->il_prev, policy->v.nodes); in interleave_nodes()
1930 struct mempolicy *policy; in mempolicy_slab_node() local
1936 policy = current->mempolicy; in mempolicy_slab_node()
1937 if (!policy || policy->flags & MPOL_F_LOCAL) in mempolicy_slab_node()
1940 switch (policy->mode) { in mempolicy_slab_node()
1945 return policy->v.preferred_node; in mempolicy_slab_node()
1948 return interleave_nodes(policy); in mempolicy_slab_node()
1961 &policy->v.nodes); in mempolicy_slab_node()
2429 new->policy ? new->policy->mode : 0); in sp_insert()
2444 mpol_get(sn->policy); in mpol_shared_policy_lookup()
2445 pol = sn->policy; in mpol_shared_policy_lookup()
2453 mpol_put(n->policy); in sp_free()
2569 node->policy = pol; in sp_node_init()
2619 *mpol_new = *n->policy; in shared_policy_replace()