From: Mike Snitzer <snitzer@kernel.org>
To: Anna Schumaker <anna@kernel.org>, Trond Myklebust <trondmy@kernel.org>
Cc: linux-nfs@vger.kernel.org,
Jonathan Flynn <jonathan.flynn@hammerspace.com>
Subject: [PATCH 00/11] NFSv4/flexfiles: scale layoutstats for striped layouts
Date: Mon, 2 Nov 2026 14:10:58 -0500 [thread overview]
Message-ID: <20261102191109.13470-1-snitzer@kernel.org> (raw)
Hi,
Since striped flexfiles layouts were introduced, each stripe of a mirror
carries its own read_stat and write_stat, but the lock protecting them
stayed in the mirror. For a RAID0-style layout (one mirror, many
stripes) that lock is effectively per-file: every DS RPC takes it twice,
once at prepare and once at completion, so striping multiplies RPC
parallelism without multiplying lock parallelism.
On a 64-core client reading one file from a 32-stripe layout with a
128KiB stripe unit (~36.7 GB/s, ~275k NFSv3 READ RPCs/s), perf reports
45% of all CPU in native_queued_spin_lock_slowpath, and 73% of the lock
contention events come from the two layoutstats paths.
This series removes that bottleneck and, along the way, fixes what the
server is told in LAYOUTSTATS for a striped mirror.
Patches 1-2 (Jonathan) move the layoutstats lock into the stripe, next
to the statistics it protects, and remove the now-unused mirror lock.
Patches 3-8 keep the per-stripe hot path to the stripe's own cachelines:
3: cacheline align the per-stripe statistics so neighbouring stripes
do not false-share
4: make dss_info->start_time write-once (try_cmpxchg64), removing its
dependence on any lock
5: drop the redundant atomic from the busy timer
6: pair the in-flight count with the layoutstats updates, under the
same lock, with lockdep assertions
7: derive ffil_ops_requested rather than storing it
8: give each direction its own lock and cacheline, so an I/O dirties
one line (the stripe shrinks from 384 to 320 bytes)
Patches 9-10 fix LAYOUTSTATS reporting for striped mirrors:
9: drop NFS4_FF_MIRROR_STAT_AVAIL. The per-mirror bit cost two atomic
RMWs per RPC on the mirror's shared cacheline, and since the first
stripe reported cleared it, a report carried only one
ff_layoutupdate4 per mirror: always the lowest usable dss_id.
10: rotate reporting across a mirror's stripes. Callers cap a report
at four entries; resume each mirror's scan where the previous
report stopped, so every busy stripe is reported within
ceil(busy_stripes / 4) report intervals instead of only the first
four ever being reported.
Patch 11 takes the report decision (pointer chases into the mirror and
layout, ktime_to_ms(), the last_report_time cmpxchg) out of the critical
section, leaving the lock to cover two writes on one cacheline.
The wire encoding is unchanged; the values reported remain cumulative
since the layout was granted.
The series is based on Anna's linux-next (nfs-for-7.4-1).
Thanks,
Mike
Jonathan Flynn (2):
NFSv4/flexfiles: move layoutstats accounting to a per-stripe lock
NFSv4/flexfiles: drop the now-unused per-mirror lock
Mike Snitzer (9):
NFSv4/flexfiles: cacheline align the per-stripe layoutstats
NFSv4/flexfiles: make dss_info->start_time write-once
NFSv4/flexfiles: drop the redundant atomic from the busy timer
NFSv4/flexfiles: pair the in-flight count with the layoutstats updates
NFSv4/flexfiles: derive ffil_ops_requested rather than storing it
NFSv4/flexfiles: give each direction its own lock and cacheline
NFSv4/flexfiles: drop NFS4_FF_MIRROR_STAT_AVAIL
NFSv4/flexfiles: rotate LAYOUTSTATS reporting across a mirror's stripes
NFSv4/flexfiles: take the report decision out of the critical section
fs/nfs/flexfilelayout/flexfilelayout.c | 251 ++++++++++++++++---------
fs/nfs/flexfilelayout/flexfilelayout.h | 74 ++++++--
2 files changed, 218 insertions(+), 107 deletions(-)
base-commit: ef30b3efb7e8bae94d790a6503a595e1051323e7
--
2.52.0
next reply other threads:[~2026-11-02 19:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 19:10 Mike Snitzer [this message]
2026-11-02 19:10 ` [PATCH 01/11] NFSv4/flexfiles: move layoutstats accounting to a per-stripe lock Mike Snitzer
2026-11-02 19:11 ` [PATCH 02/11] NFSv4/flexfiles: drop the now-unused per-mirror lock Mike Snitzer
2026-11-02 19:11 ` [PATCH 03/11] NFSv4/flexfiles: cacheline align the per-stripe layoutstats Mike Snitzer
2026-11-02 19:11 ` [PATCH 04/11] NFSv4/flexfiles: make dss_info->start_time write-once Mike Snitzer
2026-11-02 19:11 ` [PATCH 05/11] NFSv4/flexfiles: drop the redundant atomic from the busy timer Mike Snitzer
2026-11-02 19:11 ` [PATCH 06/11] NFSv4/flexfiles: pair the in-flight count with the layoutstats updates Mike Snitzer
2026-11-02 19:11 ` [PATCH 07/11] NFSv4/flexfiles: derive ffil_ops_requested rather than storing it Mike Snitzer
2026-11-02 19:11 ` [PATCH 08/11] NFSv4/flexfiles: give each direction its own lock and cacheline Mike Snitzer
2026-11-02 19:11 ` [PATCH 09/11] NFSv4/flexfiles: drop NFS4_FF_MIRROR_STAT_AVAIL Mike Snitzer
2026-11-02 19:11 ` [PATCH 10/11] NFSv4/flexfiles: rotate LAYOUTSTATS reporting across a mirror's stripes Mike Snitzer
2026-11-02 19:11 ` [PATCH 11/11] NFSv4/flexfiles: take the report decision out of the critical section Mike Snitzer
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=20261102191109.13470-1-snitzer@kernel.org \
--to=snitzer@kernel.org \
--cc=anna@kernel.org \
--cc=jonathan.flynn@hammerspace.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@kernel.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