[PATCHv1 0/8] zram: introduce multi-handle entries

From: Sergey Senozhatsky
Date: Tue Nov 19 2024 - 02:21:22 EST


ZRAM_HUGE objects are incompressible and each takes a whole
physical page on the zsmalloc side. zsmalloc pool, naturally, has
some internal memory fragmentation (within size-classes), so what
we can do for ZRAM_HUGE objects is to split them into several
smaller objects (2 at this point) and store those parts individually
in regular size-classes (hence multi-handle entries). This, basically,
lets us to use already allocated (but unused) zspages memory for
ZRAM_HUGE objects, instead of unconditional allocation of 0-order
page for each ZRAM_HUGE object.

v1:
-- reworked ZRAM_SAME patch (added missing slot lock guard for slot
flags operation, added missing .pages_stored bump, factored out
into a separate function)
-- renamed mhandle defines and added mhandle tail len define
-- fixed some typos

Sergey Senozhatsky (8):
zram: cond_resched() in writeback loop
zram: free slot memory early during write
zram: remove entry element member
zram: factor out ZRAM_SAME write
zram: factor out ZRAM_HUGE write
zram: factor out ZRAM_HUGE read
zsmalloc: move ZS_HANDLE_SIZE to zsmalloc header
zram: introduce multi-handle entries

drivers/block/zram/zram_drv.c | 368 ++++++++++++++++++++++------------
drivers/block/zram/zram_drv.h | 12 +-
include/linux/zsmalloc.h | 2 +
mm/zsmalloc.c | 2 -
4 files changed, 249 insertions(+), 135 deletions(-)

--
2.47.0.371.ga323438b13-goog