Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1275984

Re: [PATCH] zram/zcomp: use GFP_NOIO to allocate streams

From Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] zram/zcomp: use GFP_NOIO to allocate streams
Date 2015-11-24 01:30 +0100
Message-ID <qy9EB-Ie-7@gated-at.bofh.it> (permalink)
References <qxZlU-2hK-15@gated-at.bofh.it> <qy8yR-8vh-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] zram/zcomp: use GFP_NOIO to allocate streams Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2015-11-23 14:30 +0100
  Re: [PATCH] zram/zcomp: use GFP_NOIO to allocate streams Andrew Morton <akpm@linux-foundation.org> - 2015-11-24 00:20 +0100
    Re: [PATCH] zram/zcomp: use GFP_NOIO to allocate streams Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-11-24 01:30 +0100
      Re: [PATCH] zram/zcomp: use GFP_NOIO to allocate streams Andrew Morton <akpm@linux-foundation.org> - 2015-11-24 01:50 +0100
        Re: [PATCH] zram/zcomp: use GFP_NOIO to allocate streams Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-11-24 02:30 +0100
          Re: [PATCH] zram/zcomp: use GFP_NOIO to allocate streams Minchan Kim <minchan@kernel.org> - 2015-11-24 05:20 +0100
            Re: [PATCH] zram/zcomp: use GFP_NOIO to allocate streams Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-11-24 05:50 +0100
  Re: [PATCH] zram/zcomp: use GFP_NOIO to allocate streams Minchan Kim <minchan@kernel.org> - 2015-11-24 00:30 +0100

csiph-web