aboutsummaryrefslogtreecommitdiffstats
path: root/mm/oom_kill.c
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2010-08-09 20:18:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-09 23:44:56 -0400
commit6cf86ac6f36b638459a9a6c2576d5e655d41d451 (patch)
tree177ae58393bfbc5a87eb64178d426e2ba4c95871 /mm/oom_kill.c
parent4358997ae38a1901498d128d6508119d9f318b36 (diff)
oom: filter tasks not sharing the same cpuset
Tasks that do not share the same set of allowed nodes with the task that triggered the oom should not be considered as candidates for oom kill. Tasks in other cpusets with a disjoint set of mems would be unfairly penalized otherwise because of oom conditions elsewhere; an extreme example could unfairly kill all other applications on the system if a single task in a user's cpuset sets itself to OOM_DISABLE and then uses more memory than allowed. Killing tasks outside of current's cpuset rarely would free memory for current anyway. To use a sane heuristic, we must ensure that killing a task would likely free memory for current and avoid needlessly killing others at all costs just because their potential memory freeing is unknown. It is better to kill current than another task needlessly. Signed-off-by: David Rientjes <rientjes@google.com> Acked-by: Rik van Riel <riel@redhat.com> Acked-by: Nick Piggin <npiggin@suse.de> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/oom_kill.c')
-rw-r--r--mm/oom_kill.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 0c7c18f78425..6f6e04c40c93 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -184,14 +184,6 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
184 points /= 4; 184 points /= 4;
185 185
186 /* 186 /*
187 * If p's nodes don't overlap ours, it may still help to kill p
188 * because p may have allocated or otherwise mapped memory on
189 * this node before. However it will be less likely.
190 */
191 if (!has_intersects_mems_allowed(p))
192 points /= 8;
193
194 /*
195 * Adjust the score by oom_adj. 187 * Adjust the score by oom_adj.
196 */ 188 */
197 if (oom_adj) { 189 if (oom_adj) {
@@ -277,6 +269,8 @@ static struct task_struct *select_bad_process(unsigned long *ppoints,
277 continue; 269 continue;
278 if (mem && !task_in_mem_cgroup(p, mem)) 270 if (mem && !task_in_mem_cgroup(p, mem))
279 continue; 271 continue;
272 if (!has_intersects_mems_allowed(p))
273 continue;
280 274
281 /* 275 /*
282 * This task already has access to memory reserves and is 276 * This task already has access to memory reserves and is