Skip to contentSkip to conversation

Prevent excessive xfsaild wakeups

PATCH In review David Chinner 3 participants 5 messages Feb 18, 2008 – Feb 21, 2008 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Prevent excessive xfsaild wakeups

Idle state is not being detected properly by the xfsaild push code. The current idle state is detected by an empty list which may never happen with mostly idle filesystem or one using lazy superblock counters. A single dirty item in the list will result repeated looping to push everything past the target when everything because it fails to check if we managed to push anything.

Fix by considering a dirty list with everything past the target as an idle state and set the timeout appropriately.

---
 fs/xfs/xfs_trans_ail.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
fs/xfs/xfs_trans_ail.c +9 -6
Index: 2.6.x-xfs-new/fs/xfs/xfs_trans_ail.c
===================================================================
@@ -261,14 +261,17 @@ xfsaild_push(
 		xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE);
 	}
 
-	/*
-	 * We reached the target so wait a bit longer for I/O to complete and
-	 * remove pushed items from the AIL before we start the next scan from
-	 * the start of the AIL.
-	 */
-	if ((XFS_LSN_CMP(lsn, target) >= 0)) {
+	if (count && (XFS_LSN_CMP(lsn, target) >= 0)) {
+		/*
+		 * We reached the target so wait a bit longer for I/O to
+		 * complete and remove pushed items from the AIL before we
+		 * start the next scan from the start of the AIL.
+		 */
 		tout += 20;
 		last_pushed_lsn = 0;
+	} else if (!count) {
+		/* We're past our target or empty, so idle */
+		tout = 1000;
 	} else if ((restarts > XFS_TRANS_PUSH_AIL_RESTARTS) ||
 		   (count && ((stuck * 100) / count > 90))) {
 		/*
#1 lore raw

ping?

This is needed for 2.6.25-rcX....

Quoted 44 lines · David Chinner

Idle state is not being detected properly by the xfsaild push code. The current idle state is detected by an empty list which may never happen with mostly idle filesystem or one using lazy superblock counters. A single dirty item in the list will result repeated looping to push everything past the target when everything because it fails to check if we managed to push anything.

Fix by considering a dirty list with everything past the target as an idle state and set the timeout appropriately.

---
 fs/xfs/xfs_trans_ail.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Index: 2.6.x-xfs-new/fs/xfs/xfs_trans_ail.c
===================================================================

fs/xfs/xfs_trans_ail.c +9 -6
@@ -261,14 +261,17 @@ xfsaild_push(
 		xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE);
 	}
 
-	/*
-	 * We reached the target so wait a bit longer for I/O to complete and
-	 * remove pushed items from the AIL before we start the next scan from
-	 * the start of the AIL.
-	 */
-	if ((XFS_LSN_CMP(lsn, target) >= 0)) {
+	if (count && (XFS_LSN_CMP(lsn, target) >= 0)) {
+		/*
+		 * We reached the target so wait a bit longer for I/O to
+		 * complete and remove pushed items from the AIL before we
+		 * start the next scan from the start of the AIL.
+		 */
 		tout += 20;
 		last_pushed_lsn = 0;
+	} else if (!count) {
+		/* We're past our target or empty, so idle */
+		tout = 1000;
 	} else if ((restarts > XFS_TRANS_PUSH_AIL_RESTARTS) ||
 		   (count && ((stuck * 100) / count > 90))) {
 		/*
Signature · 3 lines
Dave Chinner
Principal Engineer
SGI Australian Software Group
Acked-by
#2 lore raw
Quoted 15 lines · David Chinner

ping?

This is needed for 2.6.25-rcX....

Quoted 10 lines · David Chinner

Idle state is not being detected properly by the xfsaild push code. The current idle state is detected by an empty list which may never happen with mostly idle filesystem or one using lazy superblock counters. A single dirty item in the list will result repeated looping to push everything past the target when everything because it fails to check if we managed to push anything.

Fix by considering a dirty list with everything past the target as an idle state and set the timeout appropriately.

Seems good to me.

-Eric

Quoted 34 lines
Quoted 33 lines
---
 fs/xfs/xfs_trans_ail.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Index: 2.6.x-xfs-new/fs/xfs/xfs_trans_ail.c
===================================================================

fs/xfs/xfs_trans_ail.c +9 -6
@@ -261,14 +261,17 @@ xfsaild_push(
 		xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE);
 	}
 
-	/*
-	 * We reached the target so wait a bit longer for I/O to complete and
-	 * remove pushed items from the AIL before we start the next scan from
-	 * the start of the AIL.
-	 */
-	if ((XFS_LSN_CMP(lsn, target) >= 0)) {
+	if (count && (XFS_LSN_CMP(lsn, target) >= 0)) {
+		/*
+		 * We reached the target so wait a bit longer for I/O to
+		 * complete and remove pushed items from the AIL before we
+		 * start the next scan from the start of the AIL.
+		 */
 		tout += 20;
 		last_pushed_lsn = 0;
+	} else if (!count) {
+		/* We're past our target or empty, so idle */
+		tout = 1000;
 	} else if ((restarts > XFS_TRANS_PUSH_AIL_RESTARTS) ||
 		   (count && ((stuck * 100) / count > 90))) {
 		/*
#3 lore raw
In reply to David Chinner
Quoted 4 lines · David Chinner
fs/xfs/xfs_trans_ail.c +4 -0
+	if (count && (XFS_LSN_CMP(lsn, target) >= 0)) {
+		/*
+		 * We reached the target so wait a bit longer for I/O to
+		 * complete and remove pushed items from the AIL before we

fs/xfs/xfs_trans_ail.c xfsaild_push( · line 277

Quoted 10 lines
fs/xfs/xfs_trans_ail.c +5 -0
+		 * start the next scan from the start of the AIL.
+		 */
 		tout += 20;
 		last_pushed_lsn = 0;
+	} else if (!count) {
+		/* We're past our target or empty, so idle */
+		tout = 1000;
 	} else if ((restarts > XFS_TRANS_PUSH_AIL_RESTARTS) ||
 		   (count && ((stuck * 100) / count > 90))) {
 		/*

When looking at this conditions it confuses the hell out of me. Having count checked in each of three nested conditionals simply isn't readable :)

Also some checks seem to be superflous, so how about:

	if (!count) {
		/*
		 * We're past our target or empty, so idle.
		 */
		 tout = 1000;
	} else if (XFS_LSN_CMP(lsn, target) >= 0) {
		/*
		 * We reached the target so wait a bit longer for I/O to
		 * complete and remove pushed items from the AIL before we
		 * start the next scan from the start of the AIL.
		 */
 		tout += 20;
 		last_pushed_lsn = 0;
	} else (restarts > XFS_TRANS_PUSH_AIL_RESTARTS ||
	        ((stuck * 100) / count > 90)) {
		...
	}
#4 lore raw
Quoted 11 lines · Christoph Hellwig
Quoted 10 lines · David Chinner
fs/xfs/xfs_trans_ail.c +8 -0
+	if (count && (XFS_LSN_CMP(lsn, target) >= 0)) {
+		/*
+		 * We reached the target so wait a bit longer for I/O to
+		 * complete and remove pushed items from the AIL before we
+		 * start the next scan from the start of the AIL.
+		 */
 		tout += 20;
 		last_pushed_lsn = 0;
+	} else if (!count) {
+		/* We're past our target or empty, so idle */
Quoted 8 lines

fs/xfs/xfs_trans_ail.c xfsaild_push( · line 277

Quoted 4 lines
fs/xfs/xfs_trans_ail.c +1 -0
+		tout = 1000;
 	} else if ((restarts > XFS_TRANS_PUSH_AIL_RESTARTS) ||
 		   (count && ((stuck * 100) / count > 90))) {
 		/*

When looking at this conditions it confuses the hell out of me. Having count checked in each of three nested conditionals simply isn't readable :)

Yeah, I noticed that when posting it. Got to keep you busy, Christoph. ;)

Quoted 1 line

Also some checks seem to be superflous, so how about:

Yup, fixed to be like this. I'll run it through a qa run and go from there...

Cheers,

Dave.

Signature · 3 lines
Dave Chinner
Principal Engineer
SGI Australian Software Group