public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Kyeongdon Kim <kyeongdon.kim@lge.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] zram/zcomp: use GFP_NOIO to allocate streams
Date: Tue, 24 Nov 2015 13:13:41 +0900	[thread overview]
Message-ID: <20151124041341.GB11115@blaptop> (raw)
In-Reply-To: <20151124012927.GC705@swordfish>

Hi Sergey,

On Tue, Nov 24, 2015 at 10:29:27AM +0900, Sergey Senozhatsky wrote:
> Cc Kyeongdon
> 
> On (11/23/15 16:47), Andrew Morton wrote:
> [..]
> > 
> > Doesn't make a lot of sense to me.  We use a weakened gfp for the
> > kmalloc and if that fails, fall into vmalloc() using the stronger gfp
> > anyway.
> 
> Sir, you are right. that was "fixed" in my patch (but I definitely should
> have been more attentive when I reviewed Kyeongdon's patch and that was
> a mistake to address this in my patch)
> 
> I didn't spot it until I replaced vzalloc() with __vmalloc() working on
> my GFP_NOIO patch:
> 
> +       return __vmalloc(LZ4_MEM_COMPRESS,
> +                       GFP_NOIO | __GFP_NOWARN | __GFP_HIGHMEM | __GFP_ZERO,
> +                       PAGE_KERNEL);
> 
> 
> but I agree that we have created a mess already.
> 
> > Perhaps it makes sense for higher-order allocations: we don't want to
> > thrash around trying to create an order-2 page - we'd prefer to give up
> > and fall into vmalloc to do a bunch of order-0 allocations.
> > 
> > But this argument holds for 1000 other kmalloc->vmalloc allocation
> > attempts - what's special about this one?
> > 
> > And whatever is the reason for this peculiar setup,
> > 
> > a) where's the proof that the change is actually beneficial?
> > b) let's get a good code comment in place so that future readers are not
> >    similarly puzzled.
> 
> or
> 
> c) start anew (hopefully Minchan and Kyeongdon are with me)
> 
> 
> Per Kyeongdon's comment
> 
> :When we're using LZ4 multi compression streams for zram swap,
> :we found out page allocation failure message in system running test.
> :That was not only once, but a few(2 - 5 times per test).
> :Also, some failure cases were continually occurring to try allocation
> :order 3.
> :
> :In order to make parallel compression private data, we should call
> :kzalloc() with order 2/3 in runtime(lzo/lz4). But if there is no order
> : 2/3 size memory to allocate in that time, page allocation fails.
> :This patch makes to use vmalloc() as fallback of kmalloc(), this
> :prevents page alloc failure warning.
> 
> 
> so (what I missed in the first place) is that the patch does not really
> prevent page alloc failures warnings, because vmalloc() is still free to
> warn us on every failed allocation. second, vmalloc() can fail and, thus,
> we still will go down the 'do not attempt to allocate any memory anymore,
> just wait for available stream to become idle'.
> 
> 
> so my proposal
> 
> patch 1:
>   a) switch to GFP_NOIO in critical parts (OR remove entirely remove the
>   'dynamic' stream creation functionality. IOW, do not allocate compression
>   streams from IO path, wait for and use available streams).
> 
> patch 2:
>   b) do not fallback to vmalloc (we are prepared to handle kmalloc failures)
>   c) add NOWARN to kmalloc (just to reduce the warning pressure)
> 
> 
> well, (b) and (c), technically, can be merged with (a) but I have no
> objections to have it as a separate patch.
> 
> 
> 
> what do you guys think?

First of all, Thanks for the summary and proposal.

I think GFP_NOIO critical part(ie, your lockdep fix patch) should
go to -stable so it should stand alone.

About vmalloc, I like that. Just problem was gfp and we can
pass it from upper layer so I believe it makes code looks clean
and solve differnt gfp problem.

Please look at my patchset I just sent.

Thanks a lot!

  reply	other threads:[~2015-11-24  4:13 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
2015-11-24  0:47     ` Andrew Morton
2015-11-24  1:29       ` Sergey Senozhatsky
2015-11-24  4:13         ` Minchan Kim [this message]
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=20151124041341.GB11115@blaptop \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=kyeongdon.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox