Re: [PATCH v3 11/11] zsmalloc: populate new zspage outside class->lock in zs_store()

From: Xueyuan Chen

Date: Tue Nov 17 2026 - 06:00:47 EST


On Wed, 11 Nov 2026 15:46:34 +0900, Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> wrote:
> A new zspage is not on class fullness lists and is not movable until
> zs_store() calls insert_zspage() and SetZsPageMovable(), so neither
> other zs_store() callers nor compaction and page migration can see it.
> Nobody else has the handle yet either.
>
> So for a new zspage allocate the object and copy the data before we
> take class->lock, and don't take zspage read lock. This makes
> class->lock critical section shorter and saves a zspage lock/unlock.
>
> [...]

Reviewed-by: Xueyuan Chen <xueyuan.chen21@xxxxxxxxx>

--
Best regards,
Xueyuan