From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail144.messagelabs.com (mail144.messagelabs.com [216.82.254.51]) by kanga.kvack.org (Postfix) with ESMTP id 668536B0069 for ; Wed, 9 Nov 2011 13:24:05 -0500 (EST) Received: by qyk29 with SMTP id 29so2791856qyk.14 for ; Wed, 09 Nov 2011 10:24:01 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20111109090919.C2D538AD27@mx2.suse.de> References: <20111109090919.C2D538AD27@mx2.suse.de> Date: Wed, 9 Nov 2011 10:24:01 -0800 Message-ID: Subject: Re: [PATCH resend] oom: do not kill tasks with oom_score_adj OOM_SCORE_ADJ_MIN From: Ying Han Content-Type: multipart/alternative; boundary=0016367f956c60e92a04b151646a Sender: owner-linux-mm@kvack.org List-ID: To: Michal Hocko Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Rientjes , KOSAKI Motohiro , Oleg Nesterov --0016367f956c60e92a04b151646a Content-Type: text/plain; charset=ISO-8859-1 On Fri, Nov 4, 2011 at 4:59 AM, Michal Hocko wrote: > c9f01245 (oom: remove oom_disable_count) has removed oom_disable_count > counter which has been used for early break out from oom_badness so we > could never select a task with oom_score_adj set to OOM_SCORE_ADJ_MIN > (oom disabled). > > Now that the counter is gone we are always going through heuristics > calculation and we always return a non zero positive value. This > means that we can end up killing a task with OOM disabled because it is > indistinguishable from regular tasks with 1% resp. CAP_SYS_ADMIN tasks > with 3% usage of memory or tasks with oom_score_adj set but OOM enabled. > > Let's break out early if the task should have OOM disabled. > > Signed-off-by: Michal Hocko > Acked-by: David Rientjes > Acked-by: KOSAKI Motohiro > --- > mm/oom_kill.c | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > index e916168..4465fb8 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -185,6 +185,11 @@ unsigned int oom_badness(struct task_struct *p, > struct mem_cgroup *mem, > if (!p) > return 0; > > + if (p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) { > + task_unlock(p); > + return 0; > + } > + > /* > * The memory controller may have a limit of 0 bytes, so avoid a > divide > * by zero, if necessary. > This might be late, but still: Acked-by: Ying Han Thanks for fixing this up. --Ying > -- > 1.7.7.1 > > --0016367f956c60e92a04b151646a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Fri, Nov 4, 2011 at 4:59 AM, Michal H= ocko <mhocko@suse.cz= > wrote:
c9f01245 (oom: remove oom_disable_count) has removed oom_= disable_count
counter which has been used for early break out from oom_badness so we
could never select a task with oom_score_adj set to OOM_SCORE_ADJ_MIN
(oom disabled).

Now that the counter is gone we are always going through heuristics
calculation and we always return a non zero positive value. =A0This
means that we can end up killing a task with OOM disabled because it is
indistinguishable from regular tasks with 1% resp. CAP_SYS_ADMIN tasks
with 3% usage of memory or tasks with oom_score_adj set but OOM enabled.
Let's break out early if the task should have OOM disabled.

Signed-off-by: Michal Hocko <mhocko@su= se.cz>
Acked-by: David Rientjes <rientje= s@google.com>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
=A0mm/oom_kill.c | =A0 =A05 +++++
=A01 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index e916168..4465fb8 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -185,6 +185,11 @@ unsigned int oom_badness(struct task_struct *p, struct= mem_cgroup *mem,
=A0 =A0 =A0 =A0if (!p)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return 0;

+ =A0 =A0 =A0 if (p->signal->oom_score_adj =3D=3D OOM_SCORE_ADJ_MIN) = {
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 task_unlock(p)= ;
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0;
+ =A0 =A0 =A0 }
+
=A0 =A0 =A0 =A0/*
=A0 =A0 =A0 =A0 * The memory controller may have a limit of 0 bytes, so av= oid a divide
=A0 =A0 =A0 =A0 * by zero, if necessary.
=

This might be late, but still:

=
Acked-by: Ying Han <yinghan@google.com>=A0

Thanks for fixing this up.

--Y= ing
--
1.7.7.1


--0016367f956c60e92a04b151646a-- -- 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/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org