|
|
Subscribe / Log in / New account

zsmalloc: make zsmalloc preemptible

From:  Sergey Senozhatsky <senozhatsky-AT-chromium.org>
To:  Andrew Morton <akpm-AT-linux-foundation.org>, Minchan Kim <minchan-AT-kernel.org>, Johannes Weiner <hannes-AT-cmpxchg.org>, Yosry Ahmed <yosry.ahmed-AT-linux.dev>, Nhat Pham <nphamcs-AT-gmail.com>
Subject:  [RFC PATCH 0/6] zsmalloc: make zsmalloc preemptible
Date:  Mon, 27 Jan 2025 16:59:25 +0900
Message-ID:  <20250127080254.1302026-1-senozhatsky@chromium.org>
Cc:  linux-mm-AT-kvack.org, linux-kernel-AT-vger.kernel.org, Sergey Senozhatsky <senozhatsky-AT-chromium.org>
Archive-link:  Article

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...

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




Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds