From: Yosry Ahmed <yosry@kernel.org>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Nhat Pham <nphamcs@gmail.com>,
Yosry Ahmed <yosry.ahmed@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>,
Brian Geffon <bgeffon@google.com>,
Minchan Kim <minchan@kernel.org>,
Richard Chang <richardycc@google.com>,
linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH 0/7] zsmalloc: redesign object alloc API
Date: Thu, 5 Nov 2026 17:31:26 +0000 [thread overview]
Message-ID: <auy9UfB30AlYabV8@google.com> (raw)
In-Reply-To: <20261105044752.1997895-1-senozhatsky@chromium.org>
On Thu, Nov 05, 2026 at 01:47:30PM +0900, Sergey Senozhatsky wrote:
> Both zram and zswap already have per-entry structures that store zsmalloc
> handles, so allocating a separate handle_cachep object per stored page is
> redundant. This series embeds struct zs_handle directly into zram and
> zswap entries and drops handle_cachep, saving 8 bytes and a slab
> alloc/free per stored object (2MB per 1GB of swapped out 4K pages).
I always hated that extra layer of indirection, thanks for doing this!
>
> It also folds zs_malloc() and zs_obj_write() into zs_store() so we don't
> take pool->lock and look up object location again right after allocation.
>
> A simple zram test on a 24-vCPU VM
> ==================================
> 165 fewer kernel instructions and 0.7-1.8% fewer kernel cycles per write;
> lz4 single writer +2.3% IOPS / -2.6% average latency;
> 24 writers +0.9-+1.0% IOPS; no regressions.
> Memory: 8 bytes less per stored page.
>
> Sergey Senozhatsky (7):
> zram: drop stale comment in write_incompressible_page()
> zram: drop get_slot_handle() and set_slot_handle()
> zsmalloc: switch handle type to struct zs_handle
> zram: allocate zsmalloc object under slot lock
> zsmalloc: embed struct zs_handle into zram and zswap entries
> zsmalloc: fold zs_obj_write() into zs_store()
> zsmalloc: constify struct zs_handle pointer in read-only functions
>
> Documentation/admin-guide/mm/slab.rst | 2 +-
> Documentation/core-api/memory-allocation.rst | 2 +-
> Documentation/mm/zsmalloc.rst | 8 +-
> drivers/block/zram/Kconfig | 1 +
> drivers/block/zram/zram_drv.c | 130 +++++-------
> drivers/block/zram/zram_drv.h | 10 +-
> include/linux/zsmalloc.h | 37 +++-
> mm/Kconfig | 3 +
> mm/zsmalloc.c | 204 +++++++++++--------
> mm/zswap.c | 21 +-
> 10 files changed, 229 insertions(+), 189 deletions(-)
>
> --
> 2.56.0.398.g882cbad275-goog
>
>
next prev parent reply other threads:[~2026-11-05 17:31 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 4:47 [PATCH 0/7] zsmalloc: redesign object alloc API Sergey Senozhatsky
2026-11-05 4:47 ` [PATCH 1/7] zram: drop stale comment in write_incompressible_page() Sergey Senozhatsky
2026-11-05 4:47 ` [PATCH 2/7] zram: drop get_slot_handle() and set_slot_handle() Sergey Senozhatsky
2026-11-05 4:47 ` [PATCH 3/7] zsmalloc: switch handle type to struct zs_handle Sergey Senozhatsky
2026-11-05 17:03 ` Yosry Ahmed
2026-11-10 2:42 ` Sergey Senozhatsky
2026-11-05 4:47 ` [PATCH 4/7] zram: allocate zsmalloc object under slot lock Sergey Senozhatsky
2026-11-06 4:48 ` sashiko-bot
2026-11-10 3:01 ` Sergey Senozhatsky
2026-11-05 4:47 ` [PATCH 5/7] zsmalloc: embed struct zs_handle into zram and zswap entries Sergey Senozhatsky
2026-11-05 17:19 ` Yosry Ahmed
2026-11-10 2:51 ` Sergey Senozhatsky
2026-11-10 3:12 ` Sergey Senozhatsky
2026-11-05 17:30 ` Yosry Ahmed
2026-11-10 2:44 ` Sergey Senozhatsky
2026-11-05 4:47 ` [PATCH 6/7] zsmalloc: fold zs_obj_write() into zs_store() Sergey Senozhatsky
2026-11-05 17:29 ` Yosry Ahmed
2026-11-10 2:45 ` Sergey Senozhatsky
2026-11-10 5:09 ` Sergey Senozhatsky
2026-11-05 4:47 ` [PATCH 7/7] zsmalloc: constify struct zs_handle pointer in read-only functions Sergey Senozhatsky
2026-11-05 17:31 ` Yosry Ahmed [this message]
2026-11-05 17:36 ` [PATCH 0/7] zsmalloc: redesign object alloc API Nhat Pham
2026-11-05 17:39 ` Yosry Ahmed
2026-11-10 5:49 ` Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=auy9UfB30AlYabV8@google.com \
--to=yosry@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bgeffon@google.com \
--cc=hannes@cmpxchg.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=nphamcs@gmail.com \
--cc=richardycc@google.com \
--cc=senozhatsky@chromium.org \
--cc=yosry.ahmed@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.