Skip to content

xfs: avoid transaction reservation recursion

Yafang Shao linux-fsdevel linux-mm linux-xfs 13 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v15 Latest4 patches 0 repliesNew
  2. v144 patches 3 repliesSuperseded
  3. v134 patches 10 repliesSuperseded
Earlier versions · 10
VersionPostedPatchesRepliesStatus
v124 patches6 repliesSuperseded
v114 patches7 repliesSuperseded
v104 patches6 repliesSuperseded
v92 patches2 repliesSuperseded
v8 posting 2/22 patches7 repliesSuperseded
v8 posting 1/22 patches5 repliesSuperseded
v72 patches4 repliesSuperseded
v62 patches7 repliesSuperseded
v52 patches2 repliesSuperseded
v42 patches6 repliesSuperseded

Changes in v15 from the cover letter

- fix Assertion_failed reported by kernel test robot
- run xfstests with CONFIG_XFS_ASSERT_FATAL enabled

Patches in v15 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4mm: Add become_kswapd and restore_kswapdfs/xfs/libxfs/xfs_btree.c include/linux/sched/mm.h mm/vmscan.c+31 -210 replies
2/4xfs: use memalloc_nofs_{save,restore} in xfs transactionfs/xfs/xfs_aops.c fs/xfs/xfs_linux.h fs/xfs/xfs_trans.c +1 more+21 -120 replies
3/4xfs: refactor the usage around xfs_trans_context_{set,clear}fs/xfs/xfs_trans.c fs/xfs/xfs_trans.h+20 -150 replies
4/4xfs: use current->journal_info to avoid transaction reservation recursionfs/iomap/buffered-io.c fs/xfs/xfs_aops.c fs/xfs/xfs_trans.h+29 -100 replies

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchMichal HockoDarrick J. WongChristoph Hellwig
1/4A-b R-b R-b
2/4R-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v15 thread

Cover letter [PATCH v15 0/4] xfs: avoid transaction reservation recursion

PF_FSTRANS which is used to avoid transaction reservation recursion, is dropped since commit 9070733b4efa ("xfs: abstract PF_FSTRANS to PF_MEMALLOC_NOFS") and commit 7dea19f9ee63 ("mm: introduce memalloc_nofs_{save,restore} API"), and replaced by PF_MEMALLOC_NOFS which means to avoid filesystem reclaim recursion.

As these two flags have different meanings, we'd better reintroduce PF_FSTRANS back. To avoid wasting the space of PF_* flags in task_struct, we can reuse the current->journal_info to do that, per Willy. As the check of transaction reservation recursion is used by XFS only, we can move the check into xfs_vm_writepage(s), per Dave.

Patch #1 and #2 are to use the memalloc_nofs_{save,restore} API Patch #1 is picked form Willy's patchset "Overhaul memalloc_no*"[1]

Patch #3 is the refactor of xfs_trans context, which is activated when xfs_trans is allocated and deactivated when xfs_trans is freed.

Patch #4 is the implementation of reusing current->journal_info to avoid transaction reservation recursion.

No obvious error occurred after running xfstests
(with CONFIG_XFS_ASSERT_FATAL enabled).

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

v15:
- fix Assertion_failed reported by kernel test robot
- run xfstests with CONFIG_XFS_ASSERT_FATAL enabled

v14:
- minor optimze in restore_kswapd(), per Dave.
- don't need to refactor xfs_trans_context_{set,clear}
- remove redundant comments in patch #4

v13:
- move xfs_trans_context_swap() into patch #3 and set NOFS to the old transaction

v12:
Per Darrick's suggestion,
- add the check before calling xfs_trans_context_clear() in xfs_trans_context_free().
- move t_pflags into xfs_trans_context_swap()

v11:
- add the warning at the callsite of xfs_trans_context_active()
- improve the commit log of patch #2

v10:
- refactor the code, per Dave.

v9:
- rebase it on xfs tree.
- Darrick fixed an error occurred in xfs/141
- run xfstests, and no obvious error occurred.

v8:
- check xfs_trans_context_active() in xfs_vm_writepage(s), per Dave.

v7:
- check fstrans recursion for XFS only, by introducing a new member in struct writeback_control.

v6:
- add Michal's ack and comment in patch #1.

v5:
- pick one of Willy's patch
- introduce four new helpers, per Dave

v4:
- retitle from "xfs: introduce task->in_fstrans for transaction reservation recursion protection"
- reuse current->journal_info, per Willy

Matthew Wilcox (Oracle) (1):
mm: Add become_kswapd and restore_kswapd

Yafang Shao (3):
xfs: use memalloc_nofs_{save,restore} in xfs transaction
xfs: refactor the usage around xfs_trans_context_{set,clear}
xfs: use current->journal_info to avoid transaction reservation
recursion

 fs/iomap/buffered-io.c    |  7 -------
 fs/xfs/libxfs/xfs_btree.c | 14 ++++++++------
 fs/xfs/xfs_aops.c         | 14 ++++++++++++--
 fs/xfs/xfs_linux.h        |  4 ----
 fs/xfs/xfs_trans.c        | 26 ++++++++++++--------------
 fs/xfs/xfs_trans.h        | 36 ++++++++++++++++++++++++++++++++++++
 include/linux/sched/mm.h  | 22 ++++++++++++++++++++++
 mm/vmscan.c               | 16 +---------------
 8 files changed, 91 insertions(+), 48 deletions(-)
Signature · 1 line
2.17.1