mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Kyeongdon Kim <kyeongdon.kim@lge.com>
Cc: <minchan@kernel.org>, <ngupta@vflare.org>,
	<sergey.senozhatsky.work@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] zram: try vmalloc() after kmalloc()
Date: Mon, 23 Nov 2015 14:52:26 -0800	[thread overview]
Message-ID: <20151123145226.63df6232c1f74898a980fdf2@linux-foundation.org> (raw)
In-Reply-To: <1448259675-29888-1-git-send-email-kyeongdon.kim@lge.com>

On Mon, 23 Nov 2015 15:21:15 +0900 Kyeongdon Kim <kyeongdon.kim@lge.com> wrote:

> 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.
> 
> After using this, we never found warning message in running test, also
> It could reduce process startup latency about 60-120ms in each case.
> 
> ...
>
> --- a/drivers/block/zram/zcomp_lz4.c
> +++ b/drivers/block/zram/zcomp_lz4.c
> @@ -10,17 +10,25 @@
>  #include <linux/kernel.h>
>  #include <linux/slab.h>
>  #include <linux/lz4.h>
> +#include <linux/vmalloc.h>
> +#include <linux/mm.h>
>  
>  #include "zcomp_lz4.h"
>  
>  static void *zcomp_lz4_create(void)
>  {
> -	return kzalloc(LZ4_MEM_COMPRESS, GFP_KERNEL);
> +	void *ret;
> +
> +	ret = kzalloc(LZ4_MEM_COMPRESS,
> +			__GFP_NORETRY|__GFP_NOWARN|__GFP_NOMEMALLOC);
> +	if (!ret)
> +		ret = vzalloc(LZ4_MEM_COMPRESS);
> +	return ret;
>  }

What's the reasoning behind the modification to the gfp flags?

It clears __GFP_FS, __GFP_IO and even __GFP_WAIT.  I suspect the latter
two (at least) can be retained.  And given that vmalloc() uses
GFP_KERNEL, what's the point in clearing those flags for the kmalloc()
case?

If this change (or something like it) remains in place, it should have
a comment which fully explains the reasons, please.


  parent reply	other threads:[~2015-11-23 22:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-23  6:21 Kyeongdon Kim
2015-11-23  6:35 ` Minchan Kim
2015-11-23  7:26   ` Sergey Senozhatsky
2015-11-23 22:52 ` Andrew Morton [this message]
2015-11-23 23:28   ` Minchan Kim
2015-11-23 23:40     ` Andrew Morton
2015-11-24  0:35       ` Minchan Kim
2015-11-24  1:06         ` Sergey Senozhatsky
2015-11-24  3:56           ` Minchan Kim
2015-11-24  8:09     ` Kyeongdon Kim
2015-11-24  8:15       ` Minchan Kim
2015-11-24  7:56   ` Kyeongdon 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=20151123145226.63df6232c1f74898a980fdf2@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=kyeongdon.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sergey.senozhatsky.work@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

all inboxes | Powered by JetHome®