]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit - mm/zpool.c
zswap: only save zswap header when necessary
authorYu Zhao <yuzhao@google.com>
Thu, 1 Feb 2018 00:19:59 +0000 (16:19 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 1 Feb 2018 01:18:39 +0000 (17:18 -0800)
commit9c3760eb80880f3e02546e0a2ef479e1454986b3
treee0f90aca53a602676bf50160ad1efbe0ac66a352
parenta7ab400d6fe73d0119fdc234e9982a6f80faea9f
zswap: only save zswap header when necessary

We waste sizeof(swp_entry_t) for zswap header when using zsmalloc as
zpool driver because zsmalloc doesn't support eviction.

Add zpool_evictable() to detect if zpool is potentially evictable, and
use it in zswap to avoid waste memory for zswap header.

[yuzhao@google.com: The zpool->" prefix is a result of copy & paste]
Link: http://lkml.kernel.org/r/20180110225626.110330-1-yuzhao@google.com
Link: http://lkml.kernel.org/r/20180110224741.83751-1-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Acked-by: Dan Streetman <ddstreet@ieee.org>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Seth Jennings <sjenning@redhat.com>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/zpool.h
mm/zpool.c
mm/zsmalloc.c
mm/zswap.c