[RFC PATCH 0/6] zsmalloc: make zsmalloc preemptible

Sergey Senozhatsky posted 6 patches 3 days ago
drivers/block/zram/zcomp.c    |   4 +-
drivers/block/zram/zcomp.h    |   2 +
drivers/block/zram/zram_drv.c | 169 ++++++++++-----
drivers/block/zram/zram_drv.h |   4 +
include/linux/zsmalloc.h      |  29 +++
mm/zsmalloc.c                 | 372 ++++++++++++++++++++++------------
6 files changed, 404 insertions(+), 176 deletions(-)
[RFC PATCH 0/6] zsmalloc: make zsmalloc preemptible
Posted by Sergey Senozhatsky 3 days ago
RFC

This is Part II of the series [1] that makes zram read() and write()
preemptible.  This part focuses only zsmalloc because zsmalloc imposes
atomicity restrictions on its users.  One notable example is object
mapping API, which returns with:
a) local CPU lock held
b) zspage rwlock held

First, zsmalloc is converted to use sleepable locks for internal
structs/data managements.  Second, a new handle mapping is introduced
(temporarily, until we remove zs_map_object/zs_unmap_object) which
doesn't use per-CPU buffers (and hence local CPU lock) but requires
users to provide a pointer to temp buffer for objects copy-in (when
needed) so the callers now should be able to schedule while having
objects mapped.

The series makes zsmalloc preemptible which, in turn, makes zram read()
preemptible.

[1] https://lore.kernel.org/linux-mm/20250127072932.1289973-1-senozhatsky@chromium.org

Sergey Senozhatsky (6):
  zram: deffer slot free notification
  zsmalloc: make zspage lock preemptible
  zsmalloc: convert to sleepable pool lock
  zsmalloc: make class lock sleepable
  zsmalloc: introduce handle mapping API
  zram: switch over to zshandle mapping API

 drivers/block/zram/zcomp.c    |   4 +-
 drivers/block/zram/zcomp.h    |   2 +
 drivers/block/zram/zram_drv.c | 169 ++++++++++-----
 drivers/block/zram/zram_drv.h |   4 +
 include/linux/zsmalloc.h      |  29 +++
 mm/zsmalloc.c                 | 372 ++++++++++++++++++++++------------
 6 files changed, 404 insertions(+), 176 deletions(-)

-- 
2.48.1.262.g85cc9f2d1e-goog