mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oskar Andero <oskar.andero@sonymobile.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Dolkow, Snild" <Snild.Dolkow@sonymobile.com>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Lekanovic, Radovan" <Radovan.Lekanovic@sonymobile.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Brian Swetland <swetland@google.com>
Subject: Re: [PATCH] lowmemorykiller: prevent multiple instances of low memory killer
Date: Mon, 15 Apr 2013 17:03:56 +0200	[thread overview]
Message-ID: <20130415150356.GA22161@caracas.corpusers.net> (raw)
In-Reply-To: <20130415141358.GO6692@mwanda>

On 16:13 Mon 15 Apr     , Dan Carpenter wrote:
> On Mon, Apr 15, 2013 at 03:38:08PM +0200, Dolkow, Snild wrote:
> > >Where is lowmem_shrink called from?  I only see shrink called from the
> > >bcache sysfs handler __bch_cache_set().  The return value isn't checked
> > >there.
> > >
> > >Up to now this function has only returns positive numbers.
> > >
> > >There isn't a place which check LMK_BUSY so maybe it's best to just
> > >return zero?
> > 
> > Hey Dan,
> > 
> > lowmem_shrink is assigned to a shrinker struct
> > (include/linux/shrinker.h) and called in do_shrinker_shrink() in
> > mm/vmscan.c. That, in turn, is called and checked in a few places
> > in vmscan.c.
> >
> > >From the comments in shrinker.h: 
> > "It should return the number of objects which remain in the
> > cache. If it returns -1, it means it cannot do any scanning at
> > this time (eg. there is a risk of deadlock). The callback must not
> > return -1 if nr_to_scan is zero."
> 
> Ah.  Good.  -1 is the right return.
> 
> But really should be a #define in shrinker.h instead of in
> drivers/staging/android/.

IMO one should use the errno.h values - e.g. EBUSY might be a good
value in this case. Does anyone know why the shrinker wants -1? Is there
a reason?

-Oskar

  reply	other threads:[~2013-04-15 15:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-15 13:03 Oskar Andero
2013-04-15 13:18 ` Dan Carpenter
2013-04-15 13:38   ` Dolkow, Snild
2013-04-15 14:13     ` Dan Carpenter
2013-04-15 15:03       ` Oskar Andero [this message]
2013-04-15 18:28         ` Dolkow, Snild
2013-04-15 19:49           ` Greg Kroah-Hartman
2013-04-15 23:11             ` David Rientjes
2013-04-16  6:19               ` Dan Carpenter
2013-04-16 10:59                 ` Oskar Andero
2013-04-16 20:00                   ` David Rientjes
2013-04-23 21:54                     ` Oskar Andero
2013-04-24  8:33                     ` Dolkow, Snild

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=20130415150356.GA22161@caracas.corpusers.net \
    --to=oskar.andero@sonymobile.com \
    --cc=Radovan.Lekanovic@sonymobile.com \
    --cc=Snild.Dolkow@sonymobile.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swetland@google.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

all inboxes | Powered by JetHome®