From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,senozhatsky@chromium.org,nphamcs@gmail.com,minchan@kernel.org,hannes@cmpxchg.org,chengming.zhou@linux.dev,bgeffon@google.com,axboe@kernel.dk,yosry.ahmed@linux.dev,akpm@linux-foundation.org
Subject: + zsmalloc-simplify-read-begin-end-logic.patch added to mm-new branch
Date: Wed, 07 Jan 2026 10:17:16 -0800 [thread overview]
Message-ID: <20260107181717.33245C4CEF1@smtp.kernel.org> (raw)
The patch titled
Subject: zsmalloc: simplify read begin/end logic
has been added to the -mm mm-new branch. Its filename is
zsmalloc-simplify-read-begin-end-logic.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/zsmalloc-simplify-read-begin-end-logic.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Yosry Ahmed <yosry.ahmed@linux.dev>
Subject: zsmalloc: simplify read begin/end logic
Date: Wed, 7 Jan 2026 14:21:45 +0900
When we switched from using class->size (for spans detection) to actual
compressed object size, we had to compensate for the fact that class->size
implicitly took inlined handle into consideration. In fact, instead of
adjusting the size of compressed object (adding handle offset for non-huge
size classes), we can move some lines around and simplify the code: there
are already paths in read_begin/end that compensate for inlined object
handle offset.
Link: https://lkml.kernel.org/r/20260107052145.3586917-2-senozhatsky@chromium.org
Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev>
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Brian Geffon <bgeffon@google.com>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Yosry Ahmed <yosry.ahmed@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/zsmalloc.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
--- a/mm/zsmalloc.c~zsmalloc-simplify-read-begin-end-logic
+++ a/mm/zsmalloc.c
@@ -1088,7 +1088,7 @@ void *zs_obj_read_begin(struct zs_pool *
off = offset_in_page(class->size * obj_idx);
if (!ZsHugePage(zspage))
- mem_len += ZS_HANDLE_SIZE;
+ off += ZS_HANDLE_SIZE;
if (off + mem_len <= PAGE_SIZE) {
/* this object is contained entirely within a page */
@@ -1110,9 +1110,6 @@ void *zs_obj_read_begin(struct zs_pool *
0, sizes[1]);
}
- if (!ZsHugePage(zspage))
- addr += ZS_HANDLE_SIZE;
-
return addr;
}
EXPORT_SYMBOL_GPL(zs_obj_read_begin);
@@ -1133,11 +1130,9 @@ void zs_obj_read_end(struct zs_pool *poo
off = offset_in_page(class->size * obj_idx);
if (!ZsHugePage(zspage))
- mem_len += ZS_HANDLE_SIZE;
+ off += ZS_HANDLE_SIZE;
if (off + mem_len <= PAGE_SIZE) {
- if (!ZsHugePage(zspage))
- off += ZS_HANDLE_SIZE;
handle_mem -= off;
kunmap_local(handle_mem);
}
_
Patches currently in -mm which might be from yosry.ahmed@linux.dev are
zsmalloc-simplify-read-begin-end-logic.patch
reply other threads:[~2026-01-07 18:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260107181717.33245C4CEF1@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=bgeffon@google.com \
--cc=chengming.zhou@linux.dev \
--cc=hannes@cmpxchg.org \
--cc=minchan@kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=nphamcs@gmail.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.