Skip to content

Commit

Permalink
zram/zcomp: do not zero out zcomp private pages
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sergey Senozhatsky authored and Linus Torvalds committed Jan 15, 2016
1 parent 75d8947 commit e02d238
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/block/zram/zcomp_lz4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/block/zram/zcomp_lzo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit e02d238

Please sign in to comment.