zram/zcomp: do not zero out zcomp private pages
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Thu, 14 Jan 2016 23:22:35 +0000 (15:22 -0800)
committerDanny Wood <danwood76@gmail.com>
Tue, 14 Sep 2021 19:03:00 +0000 (20:03 +0100)
Do not __GFP_ZERO allocated zcomp ->private pages.  We keep allocated
streams around and use them for read/write requests, so we supply a
zeroed out ->private to compression algorithm as a scratch buffer only
once -- the first time we use that stream.  For the rest of IO requests
served by this stream ->private usually contains some temporarily data
from the previous requests.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Change-Id: Icf20e8a707f7c925952034bc691e6ae593ef6f22

drivers/block/zram/zcomp_lz4.c
drivers/block/zram/zcomp_lzo.c

index dc2338d5258c171f55ac5d4d3576fbb9465c4643..0110086accba820402a24c2d3dfae2618c293089 100644 (file)
@@ -19,10 +19,10 @@ static void *zcomp_lz4_create(gfp_t flags)
 {
        void *ret;
 
-       ret = kzalloc(LZ4_MEM_COMPRESS, flags);
+       ret = kmalloc(LZ4_MEM_COMPRESS, flags);
        if (!ret)
                ret = __vmalloc(LZ4_MEM_COMPRESS,
-                               flags | __GFP_ZERO | __GFP_HIGHMEM,
+                               flags | __GFP_HIGHMEM,
                                PAGE_KERNEL);
        return ret;
 }
index 0ab6fce8abe4782994c7f425300a6cce1e21afaf..ed7a1f0549ecfe354726b244c42497e464be4ba4 100644 (file)
@@ -19,10 +19,10 @@ static void *lzo_create(gfp_t flags)
 {
        void *ret;
 
-       ret = kzalloc(LZO1X_MEM_COMPRESS, flags);
+       ret = kmalloc(LZO1X_MEM_COMPRESS, flags);
        if (!ret)
                ret = __vmalloc(LZO1X_MEM_COMPRESS,
-                               flags | __GFP_ZERO | __GFP_HIGHMEM,
+                               flags | __GFP_HIGHMEM,
                                PAGE_KERNEL);
        return ret;
 }