[PATCH 0/2] minimize swapping on zswap store failure
From: Nhat Pham
Date: Mon Oct 16 2023 - 20:35:24 EST
Currently, when a zswap store attempt fails, the page is immediately
swapped out. This could happen for a variety of reasons. For instance,
the compression algorithm could fail (such as when the data is not
compressible), or the backend allocator might not be able to find a
suitable slot for the compressed page. If these pages are needed
later on, users will incur IOs from swapins.
This issue prevents the adoption of zswap for potential users who
cannot tolerate the latency associated with swapping. In many cases,
these IOs are avoidable if we just keep in memory the pages that zswap
fail to store.
This patch series add two new features for zswap that will alleviate
the risk of swapping:
a) When a store attempt fail, keep the page untouched in memory
instead of swapping it out.
b) If the store attempt fails at the compression step, allow the page
to be stored in its uncompressed form in the zswap pool. This maintains
the LRU ordering of pages, which will be helpful for accurate
memory reclaim (zswap writeback in particular).
These features could be enabled independently via two new zswap module
parameters.
Nhat Pham (2):
swap: allows swap bypassing on zswap store failure
zswap: store uncompressed pages when compression algorithm fails
Documentation/admin-guide/mm/zswap.rst | 16 +++++++
include/linux/zswap.h | 9 ++++
mm/page_io.c | 6 +++
mm/shmem.c | 8 +++-
mm/zswap.c | 64 +++++++++++++++++++++++---
5 files changed, 95 insertions(+), 8 deletions(-)
--
2.34.1