aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/mempolicy.h1
-rw-r--r--include/linux/sched.h1
-rw-r--r--kernel/fork.c1
-rw-r--r--mm/mempolicy.c31
-rw-r--r--mm/slab.c4
5 files changed, 2 insertions, 36 deletions
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index cfe55dfca015..3c1b968da0ca 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -143,7 +143,6 @@ extern void numa_policy_init(void);
143extern void mpol_rebind_task(struct task_struct *tsk, const nodemask_t *new, 143extern void mpol_rebind_task(struct task_struct *tsk, const nodemask_t *new,
144 enum mpol_rebind_step step); 144 enum mpol_rebind_step step);
145extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); 145extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
146extern void mpol_fix_fork_child_flag(struct task_struct *p);
147 146
148extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, 147extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
149 unsigned long addr, gfp_t gfp_flags, 148 unsigned long addr, gfp_t gfp_flags,
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 642477dd814a..6c70645eb3b6 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1851,7 +1851,6 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1851#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ 1851#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
1852#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */ 1852#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */
1853#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ 1853#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
1854#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1855#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1854#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1856#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ 1855#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
1857#define PF_SUSPEND_TASK 0x80000000 /* this thread called freeze_processes and should not be frozen */ 1856#define PF_SUSPEND_TASK 0x80000000 /* this thread called freeze_processes and should not be frozen */
diff --git a/kernel/fork.c b/kernel/fork.c
index c777964c0662..e905e9c6b224 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1276,7 +1276,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1276 p->mempolicy = NULL; 1276 p->mempolicy = NULL;
1277 goto bad_fork_cleanup_threadgroup_lock; 1277 goto bad_fork_cleanup_threadgroup_lock;
1278 } 1278 }
1279 mpol_fix_fork_child_flag(p);
1280#endif 1279#endif
1281#ifdef CONFIG_CPUSETS 1280#ifdef CONFIG_CPUSETS
1282 p->cpuset_mem_spread_rotor = NUMA_NO_NODE; 1281 p->cpuset_mem_spread_rotor = NUMA_NO_NODE;
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 0ad0ba31979f..78e1472933ea 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -795,36 +795,6 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
795 return err; 795 return err;
796} 796}
797 797
798/*
799 * Update task->flags PF_MEMPOLICY bit: set iff non-default
800 * mempolicy. Allows more rapid checking of this (combined perhaps
801 * with other PF_* flag bits) on memory allocation hot code paths.
802 *
803 * If called from outside this file, the task 'p' should -only- be
804 * a newly forked child not yet visible on the task list, because
805 * manipulating the task flags of a visible task is not safe.
806 *
807 * The above limitation is why this routine has the funny name
808 * mpol_fix_fork_child_flag().
809 *
810 * It is also safe to call this with a task pointer of current,
811 * which the static wrapper mpol_set_task_struct_flag() does,
812 * for use within this file.
813 */
814
815void mpol_fix_fork_child_flag(struct task_struct *p)
816{
817 if (p->mempolicy)
818 p->flags |= PF_MEMPOLICY;
819 else
820 p->flags &= ~PF_MEMPOLICY;
821}
822
823static void mpol_set_task_struct_flag(void)
824{
825 mpol_fix_fork_child_flag(current);
826}
827
828/* Set the process memory policy */ 798/* Set the process memory policy */
829static long do_set_mempolicy(unsigned short mode, unsigned short flags, 799static long do_set_mempolicy(unsigned short mode, unsigned short flags,
830 nodemask_t *nodes) 800 nodemask_t *nodes)
@@ -861,7 +831,6 @@ static long do_set_mempolicy(unsigned short mode, unsigned short flags,
861 } 831 }
862 old = current->mempolicy; 832 old = current->mempolicy;
863 current->mempolicy = new; 833 current->mempolicy = new;
864 mpol_set_task_struct_flag();
865 if (new && new->mode == MPOL_INTERLEAVE && 834 if (new && new->mode == MPOL_INTERLEAVE &&
866 nodes_weight(new->v.nodes)) 835 nodes_weight(new->v.nodes))
867 current->il_next = first_node(new->v.nodes); 836 current->il_next = first_node(new->v.nodes);
diff --git a/mm/slab.c b/mm/slab.c
index 4b17f4c2e92d..3db4cb06e32e 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3027,7 +3027,7 @@ out:
3027 3027
3028#ifdef CONFIG_NUMA 3028#ifdef CONFIG_NUMA
3029/* 3029/*
3030 * Try allocating on another node if PF_SPREAD_SLAB|PF_MEMPOLICY. 3030 * Try allocating on another node if PF_SPREAD_SLAB is a mempolicy is set.
3031 * 3031 *
3032 * If we are in_interrupt, then process context, including cpusets and 3032 * If we are in_interrupt, then process context, including cpusets and
3033 * mempolicy, may not apply and should not be used for allocation policy. 3033 * mempolicy, may not apply and should not be used for allocation policy.
@@ -3259,7 +3259,7 @@ __do_cache_alloc(struct kmem_cache *cache, gfp_t flags)
3259{ 3259{
3260 void *objp; 3260 void *objp;
3261 3261
3262 if (unlikely(current->flags & (PF_SPREAD_SLAB | PF_MEMPOLICY))) { 3262 if (current->mempolicy || unlikely(current->flags & PF_SPREAD_SLAB)) {
3263 objp = alternate_node_alloc(cache, flags); 3263 objp = alternate_node_alloc(cache, flags);
3264 if (objp) 3264 if (objp)
3265 goto out; 3265 goto out;