[RFC PATCH 0/9] zswap: store zero-filled pages more efficiently

Yosry Ahmed
2024-03-25T23:50:20Z

This patch series drops the support for non-zero same-filled pages from
zswap and makes storing zero-filled pages faster and more efficient.
Non-zero same-filled pages should not be nearly as common as zero-filled
pages, so dropping support for them in favor of improving the more
common zero-filled pages makes sense. It also allows for a lot of code
cleanups.

Patch 1 is a small cleanup for zswap_store() cleanup path that also
implies a small behavioral change.

Patches 2-4 are groundword refactoring.

Patch 5 removes the userspace tunable to enable same-filled pages
handling. It arguably makes no sense anyway.

Patch 6 drops the support for non-zero same-filled pages, and patch 7
allows for storing them more efficiently. Both of these patch cause
around 1.4% improvement in the system time on kernbench. The kernel
build test only produces around 1.5% zero-filled pages. Some real
workloads are expected to have higher ratios of zero-filled pages and
hence more improvement. They also save a little bit of memory. Exact
numbers are in the commit logs.

Patch 8 drops the limit checks before handling zero-filled pages and
patch 9 does a followup cleanup of zswap_store() made possible by this
series.

This series is tagged as an RFC because it makes some potentially
controversial decisions :)

The series is based on a slightly outdated mm-unstable.

Yosry Ahmed (9):
mm: zswap: always shrink in zswap_store() if zswap_pool_reached_full
mm: zswap: refactor storing to the tree out of zswap_store()
mm: zswap: refactor limit checking from zswap_store()
mm: zswap: move more same-filled pages checks outside of zswap_store()
mm: zswap: remove zswap_same_filled_pages_enabled
mm: zswap: drop support for non-zero same-filled pages handling
mm: zswap: store zero-filled pages without a zswap_entry
mm: zswap: do not check the global limit for zero-filled pages
mm: zswap: use zswap_entry_free() for partially initialized entries

mm/zswap.c | 297 +++++++++++++++++++++++++----------------------------
1 file changed, 139 insertions(+), 158 deletions(-)

--
2.44.0.396.g6e790dbe36-goog