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: <20151124003027.GA705@swordfish>
Date:	Tue, 24 Nov 2015 09:30:27 +0900
From:	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
	Minchan Kim <minchan@...nel.org>, linux-kernel@...r.kernel.org,
	sergey.senozhatsky.work@...il.com
Subject: Re: [PATCH] zram/zcomp: use GFP_NOIO to allocate streams

On (11/23/15 15:18), Andrew Morton wrote:
[..]
> > --- a/drivers/block/zram/zcomp_lz4.c
> > +++ b/drivers/block/zram/zcomp_lz4.c
> > @@ -20,10 +20,13 @@ static void *zcomp_lz4_create(void)
> >  	void *ret;
> >  
> >  	ret = kzalloc(LZ4_MEM_COMPRESS,
> > -			__GFP_NORETRY|__GFP_NOWARN|__GFP_NOMEMALLOC);
> > -	if (!ret)
> > -		ret = vzalloc(LZ4_MEM_COMPRESS);
> > -	return ret;
> > +			__GFP_NORETRY | __GFP_NOWARN | __GFP_NOMEMALLOC);
> 
> But here we've still lost __GFP_RECLAIM, unnecessarily.  And it's quite
> unclear why __GFP_NORETRY and __GFP_NOMEMALLOC are being used.

__GFP_NORETRY

we are guaranteed to have at least one compression stream, so sooner or
later every IO operation will be served. any IO that has failed in
zcomp_lz4_create() or zcomp_lzo_create() will simply wait for already
available compression stream to become idle. so this allocation is not
so dramatically important - we just increase the level of parallelism
(N idle streams let N IO operations to execute concurrently). apart from
that we are in a low memory condition (or whatever was the reason the
kernel failed to allocate LZ4_MEM_COMPRESS or LZO1X_MEM_COMPRESS) and
we can avoid pressuring the kernel furher.

for the same reason __GFP_NOMEMALLOC is used -- we don't want to waste
an emergency memory for compression streams.


I agree on __GFP_RECLAIM. Thanks.


> IOW, why not simply use (GFP_NOIO|__GFP_NOWARN)?

GFP_NOIO | __GFP_NORETRY | __GFP_NOWARN | __GFP_NOMEMALLOC ?

	-ss
--
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