Re: [PATCH v3 10/11] zram: use rw_semaphore for decompression streams
From: Bo Zhang
Date: Fri Oct 16 2026 - 09:50:11 EST
On Fri, 16 Oct 2026 17:54:25 +0900 Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> wrote:
> A quick and dirty patch, as usual, just to play around with. This
> attempts to improve the reader side, because the reader is side
> much more sensitive. Tested only with zstd.
I applied the cross-CPU borrowing patch on-device and re-ran the same
zstd Android A/B, so it can be compared against the preempt-disable
numbers I posted earlier. Focusing on the read (exclusive decompression)
side, which is what this patch targets:
9+10+kmalloc preempt-disable cross-CPU borrow
dexcl_contended 15,919 54 1,447
dexcl_wait_ns_total 109.6 s 0.68 s 3.66 s
dexcl_wait_ns_max 145 ms 34.6 ms 26.6 ms
dexcl_avg_wait 6.88 ms 12.6 ms 2.53 ms
dexcl_acquire 2.21M 2.75M 2.94M
Borrowing clearly works: dexcl contention drops 15,919 -> 1,447 (-91%),
and the residual 1,447 are the genuinely all-CPUs-busy cases that fall
through to wait_event(). More importantly for us, the worst case and the
average are the best of the three - max 145ms -> 26.6ms (-82%), avg down
to 2.53ms.
One note so the table isn't misread: the preempt-disable column also
disabled preemption on the *write* stream, which is why its
cwrite_contended was 48; this borrow-only build has no write-side change
(cwrite_contended back at ~16k, as before 9+10). That's expected - your
patch deliberately leaves the writer side for later, and the writer
isn't on the swap-in path, so it's lower priority for us too.
Scripts and raw numbers on request.
Thanks,
Bo