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


Groups > linux.kernel > #1275943

Re: [PATCH v3] zram: try vmalloc() after kmalloc()

From Andrew Morton <akpm@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH v3] zram: try vmalloc() after kmalloc()
Date 2015-11-24 00:00 +0100
Message-ID <qy8fv-89o-9@gated-at.bofh.it> (permalink)
References <qxSNr-6uY-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

--
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 v3] zram: try vmalloc() after kmalloc() Kyeongdon Kim <kyeongdon.kim@lge.com> - 2015-11-23 07:30 +0100
  Re: [PATCH v3] zram: try vmalloc() after kmalloc() Minchan Kim <minchan@kernel.org> - 2015-11-23 07:40 +0100
    Re: [PATCH v3] zram: try vmalloc() after kmalloc() Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-11-23 08:30 +0100
  Re: [PATCH v3] zram: try vmalloc() after kmalloc() Andrew Morton <akpm@linux-foundation.org> - 2015-11-24 00:00 +0100
    Re: [PATCH v3] zram: try vmalloc() after kmalloc() Minchan Kim <minchan@kernel.org> - 2015-11-24 00:30 +0100
      Re: [PATCH v3] zram: try vmalloc() after kmalloc() Andrew Morton <akpm@linux-foundation.org> - 2015-11-24 00:50 +0100
        Re: [PATCH v3] zram: try vmalloc() after kmalloc() Minchan Kim <minchan@kernel.org> - 2015-11-24 01:40 +0100
          Re: [PATCH v3] zram: try vmalloc() after kmalloc() Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-11-24 02:10 +0100
            Re: [PATCH v3] zram: try vmalloc() after kmalloc() Minchan Kim <minchan@kernel.org> - 2015-11-24 05:00 +0100
      Re: Re: [PATCH v3] zram: try vmalloc() after kmalloc() Kyeongdon Kim <kyeongdon.kim@lge.com> - 2015-11-24 09:10 +0100
        Re: Re: [PATCH v3] zram: try vmalloc() after kmalloc() Minchan Kim <minchan@kernel.org> - 2015-11-24 09:20 +0100
    Re: Re: [PATCH v3] zram: try vmalloc() after kmalloc() Kyeongdon Kim <kyeongdon.kim@lge.com> - 2015-11-24 09:00 +0100

csiph-web