lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130415131815.GG6638@mwanda>
Date:	Mon, 15 Apr 2013 16:18:15 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Oskar Andero <oskar.andero@...ymobile.com>
Cc:	linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org,
	Snild Dolkow <snild.dolkow@...ymobile.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Radovan Lekanovic <radovan.lekanovic@...ymobile.com>,
	Brian Swetland <swetland@...gle.com>
Subject: Re: [PATCH] lowmemorykiller: prevent multiple instances of low
 memory killer

On Mon, Apr 15, 2013 at 03:03:29PM +0200, Oskar Andero wrote:
> From: Snild Dolkow <snild.dolkow@...ymobile.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@...uxfoundation.org>
> Cc: Brian Swetland <swetland@...gle.com>
> Reviewed-by: Radovan Lekanovic <radovan.lekanovic@...ymobile.com>
> Signed-off-by: Snild Dolkow <snild.dolkow@...ymobile.com>
> Signed-off-by: Oskar Andero <oskar.andero@...ymobile.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ