From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Yosry Ahmed <yosry@kernel.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
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 6/7] zsmalloc: fold zs_obj_write() into zs_store()
Date: Tue, 10 Nov 2026 14:09:41 +0900 [thread overview]
Message-ID: <avKkvXNesmBRORnn@google.com> (raw)
In-Reply-To: <avKFDz0PGwkbwNgz@google.com>
On (26/11/10 11:45), Sergey Senozhatsky wrote:
[..]
> > > spin_unlock(&class->lock);
> > > @@ -1332,8 +1324,14 @@ int zs_malloc(struct zs_pool *pool, struct zs_handle *handle, size_t size,
> > > if (!zspage)
> > > return -ENOMEM;
> > >
> > > + /*
> > > + * New zspage is not in class->fullness_list or movable yet, so we
> > > + * can allocate the object and copy data before taking class->lock.
> > > + */
> > > + obj = obj_malloc(pool, zspage, handle);
> > > + obj_write(class, zspage, obj, src, size);
> > > +
> > > spin_lock(&class->lock);
> > > - obj_malloc(pool, zspage, handle);
> >
> > Should moving obj_malloc() and obj_write() outside class->lock (and
> > skipping zspage_read_lock()) for new zspages be split into a separate
> > patch on top? AFAICT, it's a separate change from merging the
> > interfaces.
>
> Let me take a look.
I like the idea. At first it looked like we might have a tiny corner
case is when N tasks attempt to allocate in the same size class, that
has zero empty zspages, which now potentially can result in N fresh
zspages added to the size class, each having one object allocated.
But the reality is that master does that already, so nothing new.
Maybe something to look into separately.
next prev parent reply other threads:[~2026-11-10 5:09 UTC|newest]
Thread overview: 21+ 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-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 [this message]
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 ` [PATCH 0/7] zsmalloc: redesign object alloc API Yosry Ahmed
2026-11-05 17:36 ` Nhat Pham
2026-11-05 17:39 ` Yosry Ahmed
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=avKkvXNesmBRORnn@google.com \
--to=senozhatsky@chromium.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=yosry.ahmed@linux.dev \
--cc=yosry@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®