Skip to content

NFSv4/flexfiles: scale layoutstats for striped layouts

Mike Snitzer linux-nfs 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest12 patches 0 repliesNew
  2. v212 patches 0 repliesSuperseded
  3. v111 patches 12 repliesSuperseded

Changes in v3 from the cover letter

- last_report_time (patch 1) and start_time (patch 4) are now atomic64_t, updated with atomic64_try_cmpxchg(). try_cmpxchg64() on a plain 64-bit field does not build where the CPU has no 64-bit
cmpxchg: the kernel test robot reported it for ARMv7-M. This is what Anna asked about on v1. Checked with an ARMv7-M build of each patch.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12NFSv4/flexfiles: move layoutstats accounting to a per-stripe lockfs/nfs/flexfilelayout/flexfilelayout.c fs/nfs/flexfilelayout/flexfilelayout.h+26 -210 replies
2/12NFSv4/flexfiles: drop the now-unused per-mirror lockfs/nfs/flexfilelayout/flexfilelayout.c fs/nfs/flexfilelayout/flexfilelayout.h+0 -20 replies
3/12NFSv4/flexfiles: cacheline align the per-stripe layoutstatsfs/nfs/flexfilelayout/flexfilelayout.h+2 -10 replies
4/12NFSv4/flexfiles: make dss_info->start_time write-oncefs/nfs/flexfilelayout/flexfilelayout.c fs/nfs/flexfilelayout/flexfilelayout.h+16 -50 replies
5/12NFSv4/flexfiles: drop the redundant atomic from the busy timerfs/nfs/flexfilelayout/flexfilelayout.c fs/nfs/flexfilelayout/flexfilelayout.h+4 -50 replies
6/12NFSv4/flexfiles: pair the in-flight count with the layoutstats updatesfs/nfs/flexfilelayout/flexfilelayout.c fs/nfs/flexfilelayout/flexfilelayout.h+50 -480 replies
7/12NFSv4/flexfiles: derive ffil_ops_requested rather than storing itfs/nfs/flexfilelayout/flexfilelayout.c fs/nfs/flexfilelayout/flexfilelayout.h+13 -80 replies
8/12NFSv4/flexfiles: give each direction its own lock and cachelinefs/nfs/flexfilelayout/flexfilelayout.c fs/nfs/flexfilelayout/flexfilelayout.h+40 -390 replies
9/12NFSv4/flexfiles: drop NFS4_FF_MIRROR_STAT_AVAILfs/nfs/flexfilelayout/flexfilelayout.c fs/nfs/flexfilelayout/flexfilelayout.h+22 -210 replies
10/12NFSv4/flexfiles: rotate LAYOUTSTATS reporting across a mirror's stripesfs/nfs/flexfilelayout/flexfilelayout.c fs/nfs/flexfilelayout/flexfilelayout.h+13 -30 replies
11/12NFSv4/flexfiles: take the report decision out of the critical sectionfs/nfs/flexfilelayout/flexfilelayout.c+27 -220 replies
12/12NFSv4/flexfiles: share one helper for the start of a read and a writefs/nfs/flexfilelayout/flexfilelayout.c+17 -450 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 00/12] NFSv4/flexfiles: scale layoutstats for striped layouts

Hi,

Each stripe of a flexfiles mirror has its own read_stat and write_stat, but the lock that protects them is in the mirror. For a RAID0-style layout (one mirror, many stripes) that lock is per file, and every DS RPC takes it twice.

A 64-core client reads one file from a 32-stripe layout with a 128KiB stripe unit (~36.7 GB/s, ~275k NFSv3 READ RPCs/s). perf puts 45% of its CPU in native_queued_spin_lock_slowpath, and 73% of the lock contention events in the two layoutstats paths.

This series removes that bottleneck. It also fixes which stripes a LAYOUTSTATS report contains for a striped mirror.

Patches 1-2 (Jonathan) move the lock into the stripe and remove the mirror lock.

Patches 3-8 keep the per-stripe hot path in the stripe's own cachelines. After patch 8, an I/O dirties one cacheline, and reads and writes to one stripe share no lock.

Patches 9-10 fix LAYOUTSTATS for striped mirrors. A report contained only the lowest usable stripe of each mirror. It now contains each stripe with new completions, and rotates through the stripes when there are more than four.

Patch 11 moves the report decision out of the critical section.

Patch 12 combines the read and write start helpers.

The wire encoding does not change.

Changes since v2:
- last_report_time (patch 1) and start_time (patch 4) are now atomic64_t, updated with atomic64_try_cmpxchg(). try_cmpxchg64() on a plain 64-bit field does not build where the CPU has no 64-bit
cmpxchg: the kernel test robot reported it for ARMv7-M. This is what Anna asked about on v1. Checked with an ARMv7-M build of each patch.

Changes since v1, from Anna's review:
- Shorter commit messages throughout. Removed the paragraphs and the "what the server sees" passages that Anna named.
- Code comments: the cacheline explanations are now only in the commit messages. Patch 3 keeps the original lock comment. Patch 7 cuts the ops_requested comment to its locking note. Patch 9 cuts the last_reported_ops comment to its first sentence. Patch 10 removes the scan comment.
- Patch 10: renamed dss_report_start to dss_report_index and removed its comment.
- New patch 12: one start helper for reads and writes.
- American spelling throughout.

v2: https://lore.kernel.org/linux-nfs/[email protected]/
v1: https://lore.kernel.org/linux-nfs/[email protected]/

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 (10):
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 NFSv4/flexfiles: share one helper for the start of a read and a write

 fs/nfs/flexfilelayout/flexfilelayout.c | 259 +++++++++++++------------
 fs/nfs/flexfilelayout/flexfilelayout.h |  37 ++--
 2 files changed, 153 insertions(+), 143 deletions(-)

base-commit: 8cdff0c1549d3fce6bb652e6bc5dd7546e1cd1e3

Signature · 1 line
2.52.0