All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] allocate extent_buffer GFP_NOFAIL with unlocked retry
@ 2026-06-23 22:35 Boris Burkov
  2026-06-23 22:35 ` [PATCH 1/5] btrfs: factor init_extent_buffer from __alloc_extent_buffer Boris Burkov
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Boris Burkov @ 2026-06-23 22:35 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

From sampled fleet data measuring lock holders that go into direct
reclaim with a waiter present when they eventually unlock, we have
observed ~15% of those are btrfs extent_buffer allocations in
btrfs_search_slot() done while holding btree locks. This is the single
largest category. Additionally, a large source of hung_task timeouts is
both btree waiters and direct reclaiming btree allocations, which
further motivates the desire to drive down this source of stalls and
contention.

The aim of this series is to allow us to allocate the extent_buffer,
btrfs_folio_state, and the extent_buffer folios with GFP_NOWAIT then
fallback with EAGAIN to outside the critical section to retry with
GFP_NOFS | GFP_NOFAIL without any locks held.

This is analogous to how we must drop locks to read an extent_buffer and
then EAGAIN.

The series does not manage to completely eliminate allocations from this
lock holding path, as we also allocate inside xarray functions for the
extent_buffer xarray and the btree_inode mapping xarray, the latter of
which is done via filemap_add_folio() with no reserve type API. Luckily,
those particular allocations are small cached slab allocations and have
nearly no contribution to the production reclaim fueled contention.

Boris Burkov (5):
  btrfs: factor init_extent_buffer from __alloc_extent_buffer
  btrfs: add struct btrfs_eb_prealloc
  btrfs: enable unlocked NOFAIL retry for eb allocations
  btrfs: probe with GFP_NOWAIT for tree block readahead
  btrfs: use GFP_NOWAIT when inhibiting eb writeback

 fs/btrfs/ctree.c       |  36 ++++++-
 fs/btrfs/disk-io.c     |   6 +-
 fs/btrfs/disk-io.h     |   2 +
 fs/btrfs/extent-tree.c |   6 +-
 fs/btrfs/extent_io.c   | 224 ++++++++++++++++++++++++++++-------------
 fs/btrfs/extent_io.h   |  23 +++++
 fs/btrfs/subpage.c     |   7 +-
 fs/btrfs/subpage.h     |   3 +-
 fs/btrfs/tree-log.c    |   3 +-
 9 files changed, 226 insertions(+), 84 deletions(-)

-- 
2.54.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-06-23 22:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23 22:35 [PATCH 0/5] allocate extent_buffer GFP_NOFAIL with unlocked retry Boris Burkov
2026-06-23 22:35 ` [PATCH 1/5] btrfs: factor init_extent_buffer from __alloc_extent_buffer Boris Burkov
2026-06-23 22:35 ` [PATCH 2/5] btrfs: add struct btrfs_eb_prealloc Boris Burkov
2026-06-23 22:35 ` [PATCH 3/5] btrfs: enable unlocked NOFAIL retry for eb allocations Boris Burkov
2026-06-23 22:35 ` [PATCH 4/5] btrfs: probe with GFP_NOWAIT for tree block readahead Boris Burkov
2026-06-23 22:35 ` [PATCH 5/5] btrfs: use GFP_NOWAIT when inhibiting eb writeback Boris Burkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.