From 8055f8501830c65876d227b0b0f6a7cfec5da74e Mon Sep 17 00:00:00 2001 From: David Rientjes Date: Fri, 16 Dec 2011 15:49:22 +1100 Subject: [PATCH] cpusets-stall-when-updating-mems_allowed-for-mempolicy-or-disjoint-nodemask-fix-2 Here's a cleaner way of doing it, we can extend it to mm/slab.c later. Please fold into cpusets-stall-when-updating-mems_allowed-for-mempolicy-or-disjoint-nodemask.patch. Signed-off-by: David Rientjes Cc: KOSAKI Motohiro Cc: Miao Xie Cc: Paul Menage Cc: Stephen Rothwell Signed-off-by: Andrew Morton --- include/linux/mempolicy.h | 10 ++++++++++ kernel/cpuset.c | 5 +---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 7978eec1b7d9..d2589e298215 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h @@ -253,6 +253,11 @@ static inline int vma_migratable(struct vm_area_struct *vma) return 1; } +static inline bool task_has_mempolicy(struct task_struct *task) +{ + return task->mempolicy; +} + #else struct mempolicy {}; @@ -379,6 +384,11 @@ static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, return 0; } +static inline bool task_has_mempolicy(struct task_struct *task) +{ + return false; +} + #endif /* CONFIG_NUMA */ #endif /* __KERNEL__ */ diff --git a/kernel/cpuset.c b/kernel/cpuset.c index e8ed75afb755..841a440b4d37 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c @@ -968,10 +968,7 @@ repeat: * tsk does not have a mempolicy, then an empty nodemask will not be * possible when mems_allowed is larger than a word. */ - need_loop = -#ifdef CONFIG_NUMA - tsk->mempolicy || -#endif + need_loop = task_has_mempolicy(tsk) || !nodes_intersects(*newmems, tsk->mems_allowed); nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems); mpol_rebind_task(tsk, newmems, MPOL_REBIND_STEP1); -- 2.39.5