aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Hocko <mhocko@suse.com>2016-07-28 18:45:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-07-28 19:07:41 -0400
commitfec1e5f987bfc41f9f08cbd206e7302e6ac2ab0c (patch)
tree3135e0abb28984ed05862f6c1b5d3865251aa0da
parenta34c80a7294e34ba213c285dff38b1137745f94b (diff)
cpuset, mm: fix TIF_MEMDIE check in cpuset_change_task_nodemask
Commit c0ff7453bb5c ("cpuset,mm: fix no node to alloc memory when changing cpuset's mems") has added TIF_MEMDIE and PF_EXITING check but it is checking the flag on the current task rather than the given one. This doesn't make much sense and it is actually wrong. If the current task which updates the nodemask of a cpuset got killed by the OOM killer then a part of the cpuset cgroup processes would have incompatible nodemask which is surprising to say the least. The comment suggests the intention was to skip oom victim or an exiting task so we should be checking the given task. But even then it would be layering violation because it is the memory allocator to interpret the TIF_MEMDIE meaning. Simply drop both checks. All tasks in the cpuset should simply follow the same mask. Link: http://lkml.kernel.org/r/1467029719-17602-3-git-send-email-mhocko@kernel.org Signed-off-by: Michal Hocko <mhocko@suse.com> Cc: David Rientjes <rientjes@google.com> Cc: Miao Xie <miaox@cn.fujitsu.com> Cc: Miao Xie <miaoxie@huawei.com> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/cpuset.c9
1 files changed, 0 insertions, 9 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 73e93e53884d..c7fd2778ed50 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1034,15 +1034,6 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk,
1034{ 1034{
1035 bool need_loop; 1035 bool need_loop;
1036 1036
1037 /*
1038 * Allow tasks that have access to memory reserves because they have
1039 * been OOM killed to get memory anywhere.
1040 */
1041 if (unlikely(test_thread_flag(TIF_MEMDIE)))
1042 return;
1043 if (current->flags & PF_EXITING) /* Let dying task have memory */
1044 return;
1045
1046 task_lock(tsk); 1037 task_lock(tsk);
1047 /* 1038 /*
1048 * Determine if a loop is necessary if another thread is doing 1039 * Determine if a loop is necessary if another thread is doing