Thread (47 messages) 47 messages, 2 authors, 2021-08-04
STALE1797d

[PATCH 05/20] xfs: don't throttle memory reclaim trying to queue inactive inodes

From: "Darrick J. Wong" <djwong@kernel.org>
Date: 2021-07-29 18:44:22
Subsystem: filesystems (vfs and infrastructure), the rest, xfs filesystem · Maintainers: Alexander Viro, Christian Brauner, Linus Torvalds, Carlos Maiolino

From: Darrick J. Wong <djwong@kernel.org>

Now that we have the means to throttle queueing of inactive inodes and
push the background workers when memory gets tight, stop forcing tasks
that are evicting inodes from a memory reclaim context to wait for the
inodes to inactivate.

There's not much reason to make reclaimers wait, because it can take
quite a long time to inactivate an inode (particularly deleted ones) and
wait for the metadata updates to push through the logs until the incore
inode can be reclaimed.  In other words, memory allocations will no
longer stall on XFS when inode eviction requires metadata updates.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/xfs_icache.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 3e2302a44c69..82f0db311ef9 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -355,6 +355,15 @@ xfs_inodegc_want_throttle(
 {
 	struct xfs_mount	*mp = pag->pag_mount;
 
+	/*
+	 * If we're in memory reclaim context, we don't want to wait for inode
+	 * inactivation to finish because it can take a very long time to
+	 * commit all the metadata updates and push the inodes through memory
+	 * reclamation.  Also, we might be the background inodegc thread.
+	 */
+	if (current->reclaim_state != NULL)
+		return false;
+
 	/* Throttle if memory reclaim anywhere has triggered us. */
 	if (atomic_read(&mp->m_inodegc_reclaim) > 0) {
 		trace_xfs_inodegc_throttle_mempressure(mp);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help