Re: [PATCH v6 0/4] mm/zsmalloc: reduce lock contention in zs_free()

From: Barry Song (Xiaomi)

Date: Fri Jul 24 2026 - 23:58:07 EST


On Fri, Jul 24, 2026 at 12:55 PM Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> wrote:
>
> Apologies for the delay.
>
> On (26/06/27 21:36), Andrew Morton wrote:
> [..]
> > > Raspberry Pi 4B (4-core ARM64 Cortex-A72):
> > >
> > >   mode        Base       Patched     Speedup
> > >   single      59.0ms     56.0ms      1.05x
> > >   multi 2p    94.6ms     66.7ms      1.42x
> > >   multi 4p    202.9ms    110.6ms     1.83x
> > >
> > > x86 (20-core Intel i7-12700, 16 concurrent processes):
> > >
> > >   mode        Base       Patched     Speedup
> > >   single      11.7ms     9.8ms       1.19x
> > >   multi 2p    24.1ms     17.2ms      1.40x
> > >   multi 4p    63.0ms     45.3ms      1.39x
> >
> > Well that's a nice result.
>
> Indeed.
>
> > Sashiko AI review said ....  nothing.  I don't recall seeing that
> > before ;)
>
> grep-ing the code, I wonder if we maybe want to tweak some comments.
> Namely, zs_page_migrate() says:
>
>         The pool migrate_lock protects the race between zpage migration
>         and zs_free
>
> which is not entirely true anymore, as zs_free() has a lockless path
> that doesn't take pool look (when ZS_OBJ_CLASS_BITS permit).
>
> Likewise, __zs_compact() says the following about pool migrate_lock:
>
>         protect the race between zpage migration and zs_free
>
> None of these are critical, very minor.

Does it look good to you if we squash the below change into patch2/4: