Re: [PATCH] oom: break after selecting process to kill

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 12, 2014 at 02:18:17PM +0200, Michal Hocko wrote:
> On Fri 12-09-14 04:23:29, Niv Yehezkel wrote:
> [...]
> > From 1e92f232e9367565d93629b54117b27b9bbfebda Mon Sep 17 00:00:00 2001
> > From: Niv Yehezkel <executerx@xxxxxxxxx>
> > Date: Fri, 12 Sep 2014 04:21:48 -0400
> > Subject: [PATCH] break after selecting process to kill
> > 
> > 
> 
> Now the justification please ;)
> 
> > Signed-off-by: Niv Yehezkel <executerx@xxxxxxxxx>
> > ---
> >  mm/oom_kill.c |    4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> > index 1e11df8..3203578 100644
> > --- a/mm/oom_kill.c
> > +++ b/mm/oom_kill.c
> > @@ -315,7 +315,7 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
> >  		case OOM_SCAN_SELECT:
> >  			chosen = p;
> >  			chosen_points = ULONG_MAX;
> > -			/* fall through */
> > +			break;
> >  		case OOM_SCAN_CONTINUE:
> >  			continue;
> >  		case OOM_SCAN_ABORT:
> > @@ -324,6 +324,8 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
> >  		case OOM_SCAN_OK:
> >  			break;
> >  		};
> > +		if (chosen_points == ULONG_MAX)
> > +			break;
> >  		points = oom_badness(p, NULL, nodemask, totalpages);
> >  		if (!points || points < chosen_points)
> >  			continue;
> > -- 
> > 1.7.10.4
> > 
> 
> 
> -- 
> Michal Hocko
> SUSE Labs

As mentioned earlier, there's no need to keep iterating over all
running processes once the process with the highest score has been found.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]