Skip to content

AG aware parallel writeback for XFS

Kundan Kumar linux-fsdevel linux-mm linux-xfs syzbot 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest6 patches 40 repliesIn review
  2. v16 patches 0 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6iomap: add write ops hook to attach metadata to foliosfs/iomap/buffered-io.c include/linux/iomap.h+6 -00 replies
2/6xfs: add helpers to pack AG prediction info for per-folio trackingfs/xfs/xfs_iomap.h+31 -04 replies
3/6xfs: add per-inode AG prediction map and dirty-AG bitmapfs/xfs/xfs_icache.c fs/xfs/xfs_inode.h+32 -012 replies
4/6xfs: tag folios with AG number during buffered write via iomap attach hookfs/xfs/xfs_iomap.c+114 -06 replies
5/6xfs: add per-AG writeback workqueue infrastructurefs/xfs/xfs_aops.c fs/xfs/xfs_aops.h fs/xfs/xfs_mount.c +2 more+96 -04 replies
6/6xfs: offload writeback by AG using per-inode dirty bitmap and per-AG workersfs/xfs/xfs_aops.c+178 -03 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 0/6] AG aware parallel writeback for XFS

This series explores AG aware parallel writeback for XFS. The goal is to reduce writeback contention and improve scalability by allowing writeback to be distributed across allocation groups (AGs).

Problem statement
=================
Today, XFS writeback walks the page cache serially per inode and funnels all writeback through a single writeback context. For aging filesystems, especially with high parallel buffered IO this leads to limited concurrency across independent AGs.

The filesystem already has strong AG level parallelism for allocation and metadata operations, but writeback remains largely AG agnostic.

High-level approach
===================
This series introduces an AG aware writeback with following model:
1) Predict the target AG for buffered writes (mapped or delalloc) at write time.
2) Tag AG hints per folio (via lightweight metadata / xarray).
3) Track dirty AGs per inode using bitmap.
4) Offload writeback to per AG worker threads, each performing a onepass scan.
5) Workers filter folios and submit folios which are tagged for its AG.

Unlike our earlier approach that parallelized writeback by introducing multiple writeback contexts per BDI, this series keeps all changes within XFS and is orthogonal to that work. The AG aware mechanism uses per folio AG hints to route writeback to AG specific workers, and therefore applies even when a single inode’s data spans multiple AGs. This avoids the earlier limitation of relying on inode-based AG locality, which can break down on aged/fragmented filesystems.

IOPS and throughput
===================
We see significant improvemnt in IOPS if files span across multiple AG

Workload 12 files each of 500M in 12 directories(AGs) - numjobs = 12
- NVMe device Intel Optane
Base XFS : 308 MiB/s
Parallel Writeback XFS : 1534 MiB/s (+398%)

Workload 6 files each of 6G in 6 directories(AGs) - numjobs = 12
- NVMe device Intel Optane
Base XFS : 409 MiB/s
Parallel Writeback XFS : 1245 MiB/s (+204%)

These changes are on top of the v6.18 kernel release.

Future work involves tighten writeback control (wbc) handling to integrate with global writeback accounting and range semantics, also evaluate interaction with higher level writeback parallelism.

Kundan Kumar (6):
iomap: add write ops hook to attach metadata to folios
xfs: add helpers to pack AG prediction info for per-folio tracking
xfs: add per-inode AG prediction map and dirty-AG bitmap
xfs: tag folios with AG number during buffered write via iomap attach
hook
xfs: add per-AG writeback workqueue infrastructure
xfs: offload writeback by AG using per-inode dirty bitmap and per-AG
workers

 fs/iomap/buffered-io.c |   3 +
 fs/xfs/xfs_aops.c      | 257 +++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_aops.h      |   3 +
 fs/xfs/xfs_icache.c    |  27 +++++
 fs/xfs/xfs_inode.h     |   5 +
 fs/xfs/xfs_iomap.c     | 114 ++++++++++++++++++
 fs/xfs/xfs_iomap.h     |  31 +++++
 fs/xfs/xfs_mount.c     |   2 +
 fs/xfs/xfs_mount.h     |  10 ++
 fs/xfs/xfs_super.c     |   2 +
 include/linux/iomap.h  |   3 +
 11 files changed, 457 insertions(+)
Signature · 1 line
2.25.1