From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Minchan Kim <minchan@kernel.org>,
linux-kernel@vger.kernel.org, sergey.senozhatsky.work@gmail.com
Subject: Re: [PATCH] zram/zcomp: use GFP_NOIO to allocate streams
Date: Tue, 24 Nov 2015 09:30:27 +0900 [thread overview]
Message-ID: <20151124003027.GA705@swordfish> (raw)
In-Reply-To: <20151123151812.a335f9a52abd74d7017ecd85@linux-foundation.org>
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
next prev parent reply other threads:[~2015-11-24 0:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 13:27 [PATCH] zram/zcomp: use GFP_NOIO to allocate streams Sergey Senozhatsky
2015-11-23 23:18 ` Andrew Morton
2015-11-24 0:30 ` Sergey Senozhatsky [this message]
2015-11-24 0:47 ` Andrew Morton
2015-11-24 1:29 ` Sergey Senozhatsky
2015-11-24 4:13 ` Minchan Kim
2015-11-24 4:41 ` Sergey Senozhatsky
2015-11-23 23:23 ` Minchan Kim
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=20151124003027.GA705@swordfish \
--to=sergey.senozhatsky.work@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minchan@kernel.org \
--cc=sergey.senozhatsky@gmail.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.