Skip to content

Commit 7ffae69

Browse files
Michal Hockoturex
Michal Hocko
authored andcommitted
cpuset, mm: fix TIF_MEMDIE check in cpuset_change_task_nodemask
Commit c0ff745 ("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/[email protected] Signed-off-by: Michal Hocko <[email protected]> Cc: David Rientjes <[email protected]> Cc: Miao Xie <[email protected]> Cc: Miao Xie <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 30bad0d commit 7ffae69

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

kernel/cpuset.c

-9
Original file line numberDiff line numberDiff line change
@@ -1058,15 +1058,6 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk,
10581058
{
10591059
bool need_loop;
10601060

1061-
/*
1062-
* Allow tasks that have access to memory reserves because they have
1063-
* been OOM killed to get memory anywhere.
1064-
*/
1065-
if (unlikely(test_thread_flag(TIF_MEMDIE)))
1066-
return;
1067-
if (current->flags & PF_EXITING) /* Let dying task have memory */
1068-
return;
1069-
10701061
task_lock(tsk);
10711062
/*
10721063
* Determine if a loop is necessary if another thread is doing

0 commit comments

Comments
 (0)