From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail190.messagelabs.com (mail190.messagelabs.com [216.82.249.51]) by kanga.kvack.org (Postfix) with ESMTP id 7A7416B01B7 for ; Tue, 1 Jun 2010 03:18:21 -0400 (EDT) Received: from kpbe14.cbf.corp.google.com (kpbe14.cbf.corp.google.com [172.25.105.78]) by smtp-out.google.com with ESMTP id o517IJV0022023 for ; Tue, 1 Jun 2010 00:18:19 -0700 Received: from pxi17 (pxi17.prod.google.com [10.243.27.17]) by kpbe14.cbf.corp.google.com with ESMTP id o517IHwh008932 for ; Tue, 1 Jun 2010 00:18:18 -0700 Received: by pxi17 with SMTP id 17so2071393pxi.25 for ; Tue, 01 Jun 2010 00:18:17 -0700 (PDT) Date: Tue, 1 Jun 2010 00:18:15 -0700 (PDT) From: David Rientjes Subject: [patch -mm 01/18] oom: filter tasks not sharing the same cpuset In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org To: Andrew Morton Cc: Rik van Riel , Nick Piggin , Oleg Nesterov , KAMEZAWA Hiroyuki , KOSAKI Motohiro , Balbir Singh , linux-mm@kvack.org List-ID: 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. Acked-by: Rik van Riel Acked-by: Nick Piggin Acked-by: Balbir Singh Reviewed-by: KAMEZAWA Hiroyuki Signed-off-by: David Rientjes --- mm/oom_kill.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -36,7 +36,7 @@ static DEFINE_SPINLOCK(zone_scan_lock); /* #define DEBUG */ /* - * Is all threads of the target process nodes overlap ours? + * Do all threads of the target process overlap our allowed nodes? */ static int has_intersects_mems_allowed(struct task_struct *tsk) { @@ -168,14 +168,6 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) points /= 4; /* - * If p's nodes don't overlap ours, it may still help to kill p - * because p may have allocated or otherwise mapped memory on - * this node before. However it will be less likely. - */ - if (!has_intersects_mems_allowed(p)) - points /= 8; - - /* * Adjust the score by oom_adj. */ if (oom_adj) { @@ -267,6 +259,8 @@ static struct task_struct *select_bad_process(unsigned long *ppoints, continue; if (mem && !task_in_mem_cgroup(p, mem)) continue; + if (!has_intersects_mems_allowed(p)) + continue; /* * This task already has access to memory reserves and is -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org