public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Ganesh Mahendran <opensource.ganesh@gmail.com>
Cc: David Rientjes <rientjes@google.com>,
	devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
	arve@android.com, riandrews@android.com,
	linux-kernel@vger.kernel.org, sergey.senozhatsky.work@gmail.com,
	sergey.senozhatsky@gmail.com
Subject: Re: [PATCH 2/3] staging: lowmemorykiller: count anon pages only when we have swap devices
Date: Thu, 23 Jun 2016 17:42:00 +0900	[thread overview]
Message-ID: <20160623084200.GA526@swordfish> (raw)
In-Reply-To: <20160622032751.GB5683@leo-test>

On (06/22/16 11:27), Ganesh Mahendran wrote:
[..]
> > > Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
> > > ---
> > >  drivers/staging/android/lowmemorykiller.c | 12 ++++++++----
> > >  1 file changed, 8 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
> > > index 6da9260..1d8de47 100644
> > > --- a/drivers/staging/android/lowmemorykiller.c
> > > +++ b/drivers/staging/android/lowmemorykiller.c
> > > @@ -73,10 +73,14 @@ static unsigned long lowmem_deathpending_timeout;
> > >  static unsigned long lowmem_count(struct shrinker *s,
> > >  				  struct shrink_control *sc)
> > >  {
> > > -	return global_page_state(NR_ACTIVE_ANON) +
> > > -		global_page_state(NR_ACTIVE_FILE) +
> > > -		global_page_state(NR_INACTIVE_ANON) +
> > > -		global_page_state(NR_INACTIVE_FILE);
> > > +	unsigned long freeable = global_page_state(NR_ACTIVE_FILE) +
> > > +				global_page_state(NR_INACTIVE_FILE);
> > > +
> > > +	if (get_nr_swap_pages() > 0)
> > > +		freeable += global_page_state(NR_ACTIVE_ANON) +
> > > +				global_page_state(NR_INACTIVE_ANON);
> > > +
> > > +	return freeable;
> > >  }
> > >  
> > >  static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
> > 
> > Shouldn't this be advertising the amount of memory that is freeable by 
> > killing the process with the highest priority oom_score_adj?  It's not 
> > legitimate to say it can free all anon and file memory if nothing is oom 
> > killable, so this function is wrong both originally and with your patched 
> > version.
> 
> Yes, so should we just simply return 1 to make do_shrink_slab() go ahead?
> Then lowmem_scan() will do the real job to scan all the process.

hm, looking at ->scan (lowmem_scan) shouldn't it return SHRINK_STOP
when it has nothing to free instead of 0?

	-ss

  reply	other threads:[~2016-06-23  8:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-21  5:30 [PATCH 1/3] staging: lowmemorykiller: change lowmem_adj to lowmem_score_adj Ganesh Mahendran
2016-06-21  5:30 ` [PATCH 2/3] staging: lowmemorykiller: count anon pages only when we have swap devices Ganesh Mahendran
2016-06-21 20:22   ` David Rientjes
2016-06-22  3:27     ` Ganesh Mahendran
2016-06-23  8:42       ` Sergey Senozhatsky [this message]
2016-07-01  2:02         ` Ganesh Mahendran
2016-06-21  5:30 ` [PATCH 3/3] staging: lowmemorykiller: select the task with maximum rss to kill Ganesh Mahendran
2016-06-21 20:14   ` David Rientjes
2016-06-22  4:44     ` Ganesh Mahendran
2016-06-21 20:27 ` [PATCH 1/3] staging: lowmemorykiller: change lowmem_adj to lowmem_score_adj David Rientjes
2016-06-22  3:10   ` Ganesh Mahendran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160623084200.GA526@swordfish \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=arve@android.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=opensource.ganesh@gmail.com \
    --cc=riandrews@android.com \
    --cc=rientjes@google.com \
    --cc=sergey.senozhatsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox