Skip to content

Commit 7887a3d

Browse files
Nick PigginLinus Torvalds
authored andcommitted
[PATCH] oom: cpuset hint
cpuset_excl_nodes_overlap does not always indicate that killing a task will not free any memory we for us. For example, we may be asking for an allocation from _anywhere_ in the machine, or the task in question may be pinning memory that is outside its cpuset. Fix this by just causing cpuset_excl_nodes_overlap to reduce the badness rather than disallow it. Signed-off-by: Nick Piggin <[email protected]> Acked-by: Paul Jackson <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 4ff1ffb commit 7887a3d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

mm/oom_kill.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
128128
if (cap_t(p->cap_effective) & CAP_TO_MASK(CAP_SYS_RAWIO))
129129
points /= 4;
130130

131+
/*
132+
* If p's nodes don't overlap ours, it may still help to kill p
133+
* because p may have allocated or otherwise mapped memory on
134+
* this node before. However it will be less likely.
135+
*/
136+
if (!cpuset_excl_nodes_overlap(p))
137+
points /= 8;
138+
131139
/*
132140
* Adjust the score by oomkilladj.
133141
*/
@@ -198,9 +206,6 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
198206
continue;
199207
if (p->oomkilladj == OOM_DISABLE)
200208
continue;
201-
/* If p's nodes don't overlap ours, it won't help to kill p. */
202-
if (!cpuset_excl_nodes_overlap(p))
203-
continue;
204209

205210
/*
206211
* This is in the process of releasing memory so wait for it

0 commit comments

Comments
 (0)