From: Egor Shalashnov <shalasheg@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, dennis@kernel.org, tj@kernel.org,
cl@gentwo.org, zhengqi.arch@bytedance.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] percpu_ref: make percpu_ref_switch_lock per percpu_ref
Date: Sun, 29 Nov 2026 17:07:45 +0300 [thread overview]
Message-ID: <022c87a8-a640-4d18-ad7e-0df02f21ae9f@gmail.com> (raw)
In-Reply-To: <edfb1d04-0d55-47ed-b1cb-dcd8c5df75ce@gmail.com>
On 26/11/2026 00:46, Egor Shalashnov wrote:
> This might be a better approach. I'll compare it with the global-lock
> and per-reference-lock variants and report the results.
I compared the global switch lock, per-reference locks, and hashed
lock arrays with 16, 32, 64 and 128 cacheline-separated locks.
The machine has 128 logical CPUs and runs Fedora kernel
7.3.3-200.fc44.x86_64. Volumes were prefilled before each run.
To increase lock contention, fio 3.40 used io_uring with 128 jobs,
one pinned to each logical CPU. Each job discarded a separate,
non-overlapping range; together they covered the entire volume.
The maximum discard request size was 4095 MiB.
Full-volume fio discard completion times, in seconds:
Volume Global Per-ref Hash16 Hash32 Hash64 Hash128
1 TB 3.393 0.675 0.838 0.759 0.722 0.719
2 TB 5.039 1.315 1.470 1.423 1.399 1.399
4 TB 8.705 1.406 1.555 1.471 1.471 1.485
8 TB 16.955 2.667 2.991 2.835 2.834 2.832
16 TB 34.056 5.263 6.122 5.015 4.997 5.172
32 TB 67.177 9.755 12.680 10.145 9.467 9.646
64 TB 134.081 21.421 24.058 19.539 20.311 19.009
128 TB 263.881 40.170 48.588 38.663 40.135 39.236
256 TB 543.297 80.053 91.324 78.679 83.590 77.425
I also tested full-volume discard using a single blkdiscard process.
Volume Global Per-ref Hash16 Hash32 Hash64 Hash128
1 TB 2.722 1.018 1.268 1.167 1.117 1.017
2 TB 7.085 1.871 2.573 2.373 2.121 1.821
4 TB 14.354 3.025 4.932 4.179 3.878 3.427
8 TB 28.391 6.186 9.544 8.342 7.441 6.687
16 TB 56.520 11.655 19.124 16.265 14.561 13.311
32 TB 92.209 20.629 27.544 22.931 21.123 26.303
64 TB 162.383 39.483 54.974 48.209 43.342 40.180
128 TB 321.230 90.283 115.726 102.877 87.113 94.157
256 TB 556.408 181.729 231.681 210.062 177.198 165.985
The 64-lock implementation gives results close to the per-reference
implementation. I have prepared that version for the next revision.
prev parent reply other threads:[~2026-11-29 14:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <01612865-faa0-4fe5-8184-a177f104843f@gmail.com>
2026-11-25 15:55 ` Egor Shalashnov
2026-11-25 19:35 ` Andrew Morton
2026-11-25 21:46 ` Egor Shalashnov
2026-11-29 14:07 ` Egor Shalashnov [this message]
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=022c87a8-a640-4d18-ad7e-0df02f21ae9f@gmail.com \
--to=shalasheg@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=dennis@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tj@kernel.org \
--cc=zhengqi.arch@bytedance.com \
/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®