linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] oom: do not kill tasks with oom_score_adj OOM_SCORE_ADJ_MIN
@ 2011-11-04 11:59 Michal Hocko
  2011-11-07 21:54 ` David Rientjes
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Hocko @ 2011-11-04 11:59 UTC (permalink / raw)
  To: David Rientjes
  Cc: linux-mm, linux-kernel, Oleg Nesterov, Ying Han, KOSAKI Motohiro,
	Andrew Morton

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 <mhocko@suse.cz>
---
 mm/oom_kill.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index e916168..4883514 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -185,6 +185,9 @@ 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)
+		return 0;
+
 	/*
 	 * The memory controller may have a limit of 0 bytes, so avoid a divide
 	 * by zero, if necessary.
-- 
1.7.7

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] oom: do not kill tasks with oom_score_adj OOM_SCORE_ADJ_MIN
  2011-11-04 11:59 [PATCH] oom: do not kill tasks with oom_score_adj OOM_SCORE_ADJ_MIN Michal Hocko
@ 2011-11-07 21:54 ` David Rientjes
  2011-11-07 22:18   ` Michal Hocko
  2011-11-07 22:22   ` KOSAKI Motohiro
  0 siblings, 2 replies; 4+ messages in thread
From: David Rientjes @ 2011-11-07 21:54 UTC (permalink / raw)
  To: Michal Hocko
  Cc: linux-mm, linux-kernel, Oleg Nesterov, Ying Han, KOSAKI Motohiro,
	Andrew Morton

On Fri, 4 Nov 2011, Michal Hocko wrote:

> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index e916168..4883514 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -185,6 +185,9 @@ 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)
> +		return 0;
> +
>  	/*
>  	 * The memory controller may have a limit of 0 bytes, so avoid a divide
>  	 * by zero, if necessary.

This leaves p locked, you need to do task_unlock(p) first.

Once that's fixed, please add my

	Acked-by: David Rientjes <rientjes@google.com>

and resubmit to Andrew for the 3.2 rc series.  Thanks!

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] oom: do not kill tasks with oom_score_adj OOM_SCORE_ADJ_MIN
  2011-11-07 21:54 ` David Rientjes
@ 2011-11-07 22:18   ` Michal Hocko
  2011-11-07 22:22   ` KOSAKI Motohiro
  1 sibling, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2011-11-07 22:18 UTC (permalink / raw)
  To: David Rientjes
  Cc: linux-mm, linux-kernel, Oleg Nesterov, Ying Han, KOSAKI Motohiro,
	Andrew Morton

On Mon 07-11-11 13:54:38, David Rientjes wrote:
> On Fri, 4 Nov 2011, Michal Hocko wrote:
> 
> > diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> > index e916168..4883514 100644
> > --- a/mm/oom_kill.c
> > +++ b/mm/oom_kill.c
> > @@ -185,6 +185,9 @@ 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)
> > +		return 0;
> > +
> >  	/*
> >  	 * The memory controller may have a limit of 0 bytes, so avoid a divide
> >  	 * by zero, if necessary.
> 
> This leaves p locked, you need to do task_unlock(p) first.

Yes, right you are. Thanks for spotting this out.

> 
> Once that's fixed, please add my
> 
> 	Acked-by: David Rientjes <rientjes@google.com>

Thanks.

> and resubmit to Andrew for the 3.2 rc series.  Thanks!

Andrew, could you push this for 3.2 (bugfix for post 3.1 kernel).

---

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] oom: do not kill tasks with oom_score_adj OOM_SCORE_ADJ_MIN
  2011-11-07 21:54 ` David Rientjes
  2011-11-07 22:18   ` Michal Hocko
@ 2011-11-07 22:22   ` KOSAKI Motohiro
  1 sibling, 0 replies; 4+ messages in thread
From: KOSAKI Motohiro @ 2011-11-07 22:22 UTC (permalink / raw)
  To: rientjes; +Cc: mhocko, linux-mm, linux-kernel, oleg, yinghan, akpm

(11/7/2011 1:54 PM), David Rientjes wrote:
> On Fri, 4 Nov 2011, Michal Hocko wrote:
> 
>> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
>> index e916168..4883514 100644
>> --- a/mm/oom_kill.c
>> +++ b/mm/oom_kill.c
>> @@ -185,6 +185,9 @@ 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)
>> +		return 0;
>> +
>>  	/*
>>  	 * The memory controller may have a limit of 0 bytes, so avoid a divide
>>  	 * by zero, if necessary.
> 
> This leaves p locked, you need to do task_unlock(p) first.
> 
> Once that's fixed, please add my
> 
> 	Acked-by: David Rientjes <rientjes@google.com>

Agreed.
	Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-07 22:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-04 11:59 [PATCH] oom: do not kill tasks with oom_score_adj OOM_SCORE_ADJ_MIN Michal Hocko
2011-11-07 21:54 ` David Rientjes
2011-11-07 22:18   ` Michal Hocko
2011-11-07 22:22   ` KOSAKI Motohiro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox