All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Oskar Andero <oskar.andero@sonymobile.com>
Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	Snild Dolkow <snild.dolkow@sonymobile.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Radovan Lekanovic <radovan.lekanovic@sonymobile.com>,
	Brian Swetland <swetland@google.com>
Subject: Re: [PATCH] lowmemorykiller: prevent multiple instances of low memory killer
Date: Mon, 15 Apr 2013 16:18:15 +0300	[thread overview]
Message-ID: <20130415131815.GG6638@mwanda> (raw)
In-Reply-To: <1366031009-21958-1-git-send-email-oskar.andero@sonymobile.com>

On Mon, Apr 15, 2013 at 03:03:29PM +0200, Oskar Andero wrote:
> From: Snild Dolkow <snild.dolkow@sonymobile.com>
> 
> Running multiple instances of LMK is not useful since it will try to
> kill the same process.
> 
> This patch adds a spinlock to prevent multiple instances of the LMK
> running at the same time. Uses spin_trylock and return on failure to
> avoid blocking.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Brian Swetland <swetland@google.com>
> Reviewed-by: Radovan Lekanovic <radovan.lekanovic@sonymobile.com>
> Signed-off-by: Snild Dolkow <snild.dolkow@sonymobile.com>
> Signed-off-by: Oskar Andero <oskar.andero@sonymobile.com>
> ---
>  drivers/staging/android/lowmemorykiller.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
> index 3b91b0f..0b19353 100644
> --- a/drivers/staging/android/lowmemorykiller.c
> +++ b/drivers/staging/android/lowmemorykiller.c
> @@ -38,6 +38,7 @@
>  #include <linux/rcupdate.h>
>  #include <linux/profile.h>
>  #include <linux/notifier.h>
> +#include <linux/spinlock.h>
>  
>  static uint32_t lowmem_debug_level = 2;
>  static short lowmem_adj[6] = {
> @@ -57,6 +58,8 @@ static int lowmem_minfree_size = 4;
>  
>  static unsigned long lowmem_deathpending_timeout;
>  
> +#define LMK_BUSY (-1)

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?

regards,
dan carpenter


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

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-15 13:03 [PATCH] lowmemorykiller: prevent multiple instances of low memory killer Oskar Andero
2013-04-15 13:18 ` Dan Carpenter [this message]
2013-04-15 13:38   ` Dolkow, Snild
2013-04-15 14:13     ` Dan Carpenter
2013-04-15 15:03       ` Oskar Andero
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=20130415131815.GG6638@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oskar.andero@sonymobile.com \
    --cc=radovan.lekanovic@sonymobile.com \
    --cc=snild.dolkow@sonymobile.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.