public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: idle aild if the AIL is pushed up to the target LSN
@ 2016-04-25  7:42 Lucas Stach
  2016-04-25 14:24 ` Brian Foster
  0 siblings, 1 reply; 6+ messages in thread
From: Lucas Stach @ 2016-04-25  7:42 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs, linux-kernel

The current logic only idles aild if the AIL is empty, rescheduling
the worker with a timeout of 50ms otherwise. If the target LSN isn't
moved forward, the worker will not make any progress as it only
pushes the AIL up to the target LSN, leading to the empty AIL
condition to only be met after the log worker pushed the complete
AIL. As the log worker runs on the scale of minutes, this leaves
aild in the "no progress, 50ms timeout" state for extended periods of
time, causing many unecessary wakeups.

Fix this by idling aild as soon as the AIL is pushed up to the target
LSN. All code paths that move the target LSN forward already ensure
that aild is woken up again when needed.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
I'm pretty sure that the above deduction is correct, but as this my
first real encounter with the XFS code base, someone with a bit more
knowledge than me should give this some thought.
---
 fs/xfs/xfs_trans_ail.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index d6c9c3e..7eca852 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -495,6 +495,7 @@ xfsaild(
 {
 	struct xfs_ail	*ailp = data;
 	long		tout = 0;	/* milliseconds */
+	struct xfs_log_item *lip;
 
 	current->flags |= PF_MEMALLOC;
 	set_freezable();
@@ -508,7 +509,8 @@ xfsaild(
 		spin_lock(&ailp->xa_lock);
 
 		/*
-		 * Idle if the AIL is empty and we are not racing with a target
+		 * Idle if the AIL is empty or pushed up to the requested
+		 * target LSN and we are not racing with a target
 		 * update. We check the AIL after we set the task to a sleep
 		 * state to guarantee that we either catch an xa_target update
 		 * or that a wake_up resets the state to TASK_RUNNING.
@@ -517,7 +519,8 @@ xfsaild(
 		 * The barrier matches the xa_target update in xfs_ail_push().
 		 */
 		smp_rmb();
-		if (!xfs_ail_min(ailp) &&
+		lip = xfs_ail_min(ailp);
+		if ((!lip || XFS_LSN_CMP(lip->li_lsn, ailp->xa_target) >= 0) &&
 		    ailp->xa_target == ailp->xa_target_prev) {
 			spin_unlock(&ailp->xa_lock);
 			freezable_schedule();
-- 
2.5.5

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

end of thread, other threads:[~2016-04-27 22:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-25  7:42 [PATCH] xfs: idle aild if the AIL is pushed up to the target LSN Lucas Stach
2016-04-25 14:24 ` Brian Foster
2016-04-25 18:11   ` Lucas Stach
2016-04-25 23:08     ` Dave Chinner
2016-04-27 18:31       ` Lucas Stach
2016-04-27 22:29         ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox