Skip to content

xfs: CPU usage optimizations for realtime allocator

Omar Sandoval linux-xfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 10 repliesIn review
  2. v16 patches 16 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6xfs: cache last bitmap block in realtime allocatorfs/xfs/libxfs/xfs_rtbitmap.c fs/xfs/xfs_rtalloc.c fs/xfs/xfs_rtalloc.h+170 -1585 replies
2/6xfs: invert the realtime summary cachefs/xfs/libxfs/xfs_rtbitmap.c fs/xfs/xfs_mount.h fs/xfs/xfs_rtalloc.c+25 -181 reply
3/6xfs: return maximum free size from xfs_rtany_summary()fs/xfs/xfs_rtalloc.c+9 -91 reply
4/6xfs: limit maxlen based on available space in xfs_rtallocate_extent_near()fs/xfs/xfs_rtalloc.c+6 -31 reply
5/6xfs: don't try redundant allocations in xfs_rtallocate_extent_near()fs/xfs/xfs_rtalloc.c+5 -451 reply
6/6xfs: don't look for end of extent further than necessary in xfs_rtallocate_extent_near()fs/xfs/xfs_rtalloc.c+21 -41 reply

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchDarrick J. WongChristoph Hellwig
1/6R-b
2/6R-b
3/6R-b R-b
4/6R-b
5/6R-b
6/6R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/6] xfs: CPU usage optimizations for realtime allocator

Hello,

This is version 2 of my XFS realtime allocator opimization patch series.

Changes since v1 [1]:

- Fixed potential overflow in patch 4.
- Changed deprecated typedefs to normal struct names
- Fixed broken indentation
- Used xfs_fileoff_t instead of xfs_fsblock_t where appropriate.
- Added calls to xfs_rtbuf_cache_relse anywhere that the cache is used instead of relying on the buffers being dirtied and thus attached to the transaction.
- Clarified comments and commit messages in a few places.
- Added Darrick's Reviewed-bys.

Cover letter from v1:

Our distributed storage system uses XFS's realtime device support as a way to split an XFS filesystem between an SSD and an HDD -- we configure the HDD as the realtime device so that metadata goes on the SSD and data goes on the HDD.

We've been running this in production for a few years now, so we have some fairly fragmented filesystems. This has exposed various CPU inefficiencies in the realtime allocator. These became even worse when we experimented with using XFS_XFLAG_EXTSIZE to force files to be allocated contiguously.

This series adds several optimizations that don't change the realtime allocator's decisions, but make them happen more efficiently, mainly by avoiding redundant work. We've tested these in production and measured ~10% lower CPU utilization. Furthermore, it made it possible to use XFS_XFLAG_EXTSIZE to force contiguous allocations -- without these patches, our most fragmented systems would become unresponsive due to high CPU usage in the realtime allocator, but with them, CPU utilization is actually ~4-6% lower than before, and disk I/O utilization is 15-20% lower.

Patches 2 and 3 are preparations for later optimizations; the remaining patches are the optimizations themselves.

1: https://lore.kernel.org/linux-xfs/[email protected]/

Omar Sandoval (6):
xfs: cache last bitmap block in realtime allocator
xfs: invert the realtime summary cache
xfs: return maximum free size from xfs_rtany_summary()
xfs: limit maxlen based on available space in
xfs_rtallocate_extent_near()
xfs: don't try redundant allocations in xfs_rtallocate_extent_near()
xfs: don't look for end of extent further than necessary in
xfs_rtallocate_extent_near()

 fs/xfs/libxfs/xfs_rtbitmap.c | 185 ++++++++++++++--------------
 fs/xfs/xfs_mount.h           |   6 +-
 fs/xfs/xfs_rtalloc.c         | 228 ++++++++++++++++-------------------
 fs/xfs/xfs_rtalloc.h         |  30 +++--
 4 files changed, 224 insertions(+), 225 deletions(-)
Signature · 1 line
2.41.0