mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bo Zhang <zhangbo0325@gmail.com>
To: senozhatsky@chromium.org
Cc: akpm@linux-foundation.org, baohua@kernel.org, bgeffon@google.com,
	minchan@kernel.org, richardycc@google.com,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH v3 10/11] zram: use rw_semaphore for decompression streams
Date: Fri, 16 Oct 2026 21:48:47 +0800	[thread overview]
Message-ID: <20261016134847.1620103-1-zhangbo0325@gmail.com> (raw)
In-Reply-To: <atHftz13hWzGludk@google.com>

On Fri, 16 Oct 2026 17:54:25 +0900 Sergey Senozhatsky <senozhatsky@chromium.org> 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

  reply	other threads:[~2026-10-16 13:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13  3:50 [PATCH v3 00/11] zram: redesign zcomp and rework backends Sergey Senozhatsky
2026-10-13  3:50 ` [PATCH v3 01/11] zram: prefix backends printk-s Sergey Senozhatsky
2026-10-13  3:50 ` [PATCH v3 02/11] zram: remove debugfs entry on init failure Sergey Senozhatsky
2026-10-13  3:50 ` [PATCH v3 03/11] zram: zstd: do not allocate empty C/D-dictionaries Sergey Senozhatsky
2026-10-13  3:50 ` [PATCH v3 04/11] zram: lz4hc: pre-initialize dictionary stream in setup_params Sergey Senozhatsky
2026-10-13  3:50 ` [PATCH v3 05/11] zram: lz4: use LZ4_decompress_safe_usingDict() Sergey Senozhatsky
2026-10-13  3:50 ` [PATCH v3 06/11] zram: lz4hc: " Sergey Senozhatsky
2026-10-13  3:50 ` [PATCH v3 07/11] zram: zstd: do not use kvzalloc() for zstd allocations Sergey Senozhatsky
2026-10-13  3:50 ` [PATCH v3 08/11] zram: reset writeback state in zram_reset_device() Sergey Senozhatsky
2026-10-13  3:50 ` [PATCH v3 09/11] zram: split zcomp into separate R/W streams Sergey Senozhatsky
2026-10-13  3:50 ` [PATCH v3 10/11] zram: use rw_semaphore for decompression streams Sergey Senozhatsky
2026-10-14 15:36   ` Bo Zhang
2026-10-14 20:46     ` Barry Song
2026-10-15  2:04       ` Sergey Senozhatsky
2026-10-15  3:19       ` Bo Zhang
2026-10-15  3:24         ` Sergey Senozhatsky
2026-10-15  1:41     ` Sergey Senozhatsky
2026-10-15  2:11       ` Sergey Senozhatsky
2026-10-15  3:19       ` Sergey Senozhatsky
2026-10-15  5:18         ` Sergey Senozhatsky
2026-10-15 11:24           ` Bo Zhang
2026-10-16  2:50             ` Sergey Senozhatsky
2026-10-16  3:10               ` Barry Song
2026-10-16  3:13                 ` Sergey Senozhatsky
2026-10-16  8:54               ` Sergey Senozhatsky
2026-10-16 13:48                 ` Bo Zhang [this message]
2026-10-13  3:50 ` [PATCH v3 11/11] zram: use a singleton compression context for recompression Sergey Senozhatsky

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=20261016134847.1620103-1-zhangbo0325@gmail.com \
    --to=zhangbo0325@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=bgeffon@google.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=richardycc@google.com \
    --cc=senozhatsky@chromium.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®