Commit 2ccd9fec authored by Johannes Weiner's avatar Johannes Weiner Committed by Andrew Morton
Browse files

mm: remove unused zpool layer

With zswap using zsmalloc directly, there are no more in-tree users of
this code.  Remove it.

With zpool gone, zsmalloc is now always a simple dependency and no
longer something the user needs to configure. Hide CONFIG_ZSMALLOC
from the user and have zswap and zram pull it in as needed.

Link: https://lkml.kernel.org/r/20250829162212.208258-3-hannes@cmpxchg.org


Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Acked-by: default avatarSeongJae Park <sj@kernel.org>
Acked-by: default avatarYosry Ahmed <yosry.ahmed@linux.dev>
Cc: Chengming Zhou <zhouchengming@bytedance.com>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Vitaly Wool <vitaly.wool@konsulko.se>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 5c3f8be0
Loading
Loading
Loading
Loading
+12 −21
Original line number Diff line number Diff line
@@ -53,26 +53,17 @@ Zswap receives pages for compression from the swap subsystem and is able to
evict pages from its own compressed pool on an LRU basis and write them back to
the backing swap device in the case that the compressed pool is full.

Zswap makes use of zpool for the managing the compressed memory pool.  Each
allocation in zpool is not directly accessible by address.  Rather, a handle is
Zswap makes use of zsmalloc for the managing the compressed memory pool.  Each
allocation in zsmalloc is not directly accessible by address.  Rather, a handle is
returned by the allocation routine and that handle must be mapped before being
accessed.  The compressed memory pool grows on demand and shrinks as compressed
pages are freed.  The pool is not preallocated.  By default, a zpool
of type selected in ``CONFIG_ZSWAP_ZPOOL_DEFAULT`` Kconfig option is created,
but it can be overridden at boot time by setting the ``zpool`` attribute,
e.g. ``zswap.zpool=zsmalloc``. It can also be changed at runtime using the sysfs
``zpool`` attribute, e.g.::

	echo zsmalloc > /sys/module/zswap/parameters/zpool

The zsmalloc type zpool has a complex compressed page storage method, and it
can achieve great storage densities.
pages are freed.  The pool is not preallocated.

When a swap page is passed from swapout to zswap, zswap maintains a mapping
of the swap entry, a combination of the swap type and swap offset, to the zpool
handle that references that compressed swap page.  This mapping is achieved
with a red-black tree per swap type.  The swap offset is the search key for the
tree nodes.
of the swap entry, a combination of the swap type and swap offset, to the
zsmalloc handle that references that compressed swap page.  This mapping is
achieved with a red-black tree per swap type.  The swap offset is the search
key for the tree nodes.

During a page fault on a PTE that is a swap entry, the swapin code calls the
zswap load function to decompress the page into the page allocated by the page
@@ -96,11 +87,11 @@ attribute, e.g.::

	echo lzo > /sys/module/zswap/parameters/compressor

When the zpool and/or compressor parameter is changed at runtime, any existing
compressed pages are not modified; they are left in their own zpool.  When a
request is made for a page in an old zpool, it is uncompressed using its
original compressor.  Once all pages are removed from an old zpool, the zpool
and its compressor are freed.
When the compressor parameter is changed at runtime, any existing compressed
pages are not modified; they are left in their own pool.  When a request is
made for a page in an old pool, it is uncompressed using its original
compressor.  Once all pages are removed from an old pool, the pool and its
compressor are freed.

Some of the pages in zswap are same-value filled pages (i.e. contents of the
page have same value or repetitive pattern). These pages include zero-filled
+0 −1
Original line number Diff line number Diff line
@@ -118,7 +118,6 @@ More Memory Management Functions
.. kernel-doc:: mm/memremap.c
.. kernel-doc:: mm/hugetlb.c
.. kernel-doc:: mm/swap.c
.. kernel-doc:: mm/zpool.c
.. kernel-doc:: mm/memcontrol.c
.. #kernel-doc:: mm/memory-tiers.c (build warnings)
.. kernel-doc:: mm/shmem.c
+0 −2
Original line number Diff line number Diff line
@@ -476,7 +476,6 @@ Use the following commands to enable zswap::
  # echo 0 > /sys/module/zswap/parameters/enabled
  # echo 50 > /sys/module/zswap/parameters/max_pool_percent
  # echo deflate-iaa > /sys/module/zswap/parameters/compressor
  # echo zsmalloc > /sys/module/zswap/parameters/zpool
  # echo 1 > /sys/module/zswap/parameters/enabled
  # echo 100 > /proc/sys/vm/swappiness
  # echo never > /sys/kernel/mm/transparent_hugepage/enabled
@@ -625,7 +624,6 @@ the 'fixed' compression mode::
  echo 0 > /sys/module/zswap/parameters/enabled
  echo 50 > /sys/module/zswap/parameters/max_pool_percent
  echo deflate-iaa > /sys/module/zswap/parameters/compressor
  echo zsmalloc > /sys/module/zswap/parameters/zpool
  echo 1 > /sys/module/zswap/parameters/enabled

  echo 100 > /proc/sys/vm/swappiness
+0 −2
Original line number Diff line number Diff line
@@ -27879,9 +27879,7 @@ R: Chengming Zhou <chengming.zhou@linux.dev>
L:	linux-mm@kvack.org
S:	Maintained
F:	Documentation/admin-guide/mm/zswap.rst
F:	include/linux/zpool.h
F:	include/linux/zswap.h
F:	mm/zpool.c
F:	mm/zswap.c
F:	tools/testing/selftests/cgroup/test_zswap.c
+0 −1
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ CONFIG_CMDLINE_PARTITION=y
CONFIG_IOSCHED_BFQ=y
CONFIG_BFQ_GROUP_IOSCHED=y
CONFIG_BINFMT_MISC=m
CONFIG_ZPOOL=y
CONFIG_ZSWAP=y
CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD=y
CONFIG_ZSMALLOC=y
Loading