mbox series

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

Message ID 20250127080254.1302026-1-senozhatsky@chromium.org (mailing list archive)
Headers show
Series zsmalloc: make zsmalloc preemptible | expand

Message

Sergey Senozhatsky Jan. 27, 2025, 7:59 a.m. UTC
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(-)