]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xfs: add tunable threshold parameter for triggering zone GC
authorHans Holmberg <Hans.Holmberg@wdc.com>
Tue, 25 Mar 2025 09:10:49 +0000 (09:10 +0000)
committerCarlos Maiolino <cem@kernel.org>
Mon, 14 Apr 2025 08:41:33 +0000 (10:41 +0200)
commit845abeb1f06a8a44e21314460eeb14cddfca52cc
treef5e453da592114ec67f8abc47b6808ee22eaab07
parenta1a56f541a8f634007de4bcb45aa3eaf803154a8
xfs: add tunable threshold parameter for triggering zone GC

Presently we start garbage collection late - when we start running
out of free zones to backfill max_open_zones. This is a reasonable
default as it minimizes write amplification. The longer we wait,
the more blocks are invalidated and reclaim cost less in terms
of blocks to relocate.

Starting this late however introduces a risk of GC being outcompeted
by user writes. If GC can't keep up, user writes will be forced to
wait for free zones with high tail latencies as a result.

This is not a problem under normal circumstances, but if fragmentation
is bad and user write pressure is high (multiple full-throttle
writers) we will "bottom out" of free zones.

To mitigate this, introduce a zonegc_low_space tunable that lets the
user specify a percentage of how much of the unused space that GC
should keep available for writing. A high value will reclaim more of
the space occupied by unused blocks, creating a larger buffer against
write bursts.

This comes at a cost as write amplification is increased. To
illustrate this using a sample workload, setting zonegc_low_space to
60% avoids high (500ms) max latencies while increasing write
amplification by 15%.

Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Documentation/admin-guide/xfs.rst
fs/xfs/xfs_mount.h
fs/xfs/xfs_sysfs.c
fs/xfs/xfs_zone_alloc.c
fs/xfs/xfs_zone_gc.c