Re: 2.6.23-rc6-mm1 -- mkfs stuck in 'D'

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Hugh Dickins
Date: Wednesday, September 19, 2007 - 1:03 pm

On Wed, 19 Sep 2007, Andy Whitcroft wrote:

[edited out some bogus lines from stale stack]


I've been seeing something like that on 4-way PPC64: in my case I've
shells hanging in D state trying to append to kernel build log on ext3
(the builds themselves going on elsewhere, in tmpfs): one of the shells
holding i_mutex and stuck doing congestion_waits from balance_dirty_pages.


My *guess* is that this is peculiar to 2.6.23-rc6-mm1, and from Peter's
mm-per-device-dirty-threshold.patch.  printks showed bdi_nr_reclaimable
0, bdi_nr_writeback 24, bdi_thresh 1 in balance_dirty_pages (though I've
not done enough to check if those really correlate with the hangs),
and I'm wondering if the bdi_stat_sum business is needed on the
!nr_reclaimable path.

So I'm running now with the patch below, good so far, but can't judge
until tomorrow whether it has actually addressed the problem seen.

Not-yet-Signed-off-by: Hugh Dickins <hugh@veritas.com>
---
 mm/page-writeback.c |   53 +++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 29 deletions(-)

--- 2.6.23-rc6-mm1/mm/page-writeback.c	2007-09-18 12:28:25.000000000 +0100
+++ linux/mm/page-writeback.c	2007-09-19 20:00:46.000000000 +0100
@@ -379,7 +379,7 @@ static void balance_dirty_pages(struct a
 		bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE);
 		bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK);
 		if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh)
-				break;
+			break;
 
 		if (!bdi->dirty_exceeded)
 			bdi->dirty_exceeded = 1;
@@ -392,39 +392,34 @@ static void balance_dirty_pages(struct a
 		 */
 		if (bdi_nr_reclaimable) {
 			writeback_inodes(&wbc);
-
+			pages_written += write_chunk - wbc.nr_to_write;
 			get_dirty_limits(&background_thresh, &dirty_thresh,
 				       &bdi_thresh, bdi);
+		}
 
-			/*
-			 * In order to avoid the stacked BDI deadlock we need
-			 * to ensure we accurately count the 'dirty' pages when
-			 * the threshold is low.
-			 *
-			 * Otherwise it would be possible to get thresh+n pages
-			 * reported dirty, even though there are thresh-m pages
-			 * actually dirty; with m+n sitting in the percpu
-			 * deltas.
-			 */
-			if (bdi_thresh < 2*bdi_stat_error(bdi)) {
-				bdi_nr_reclaimable =
-					bdi_stat_sum(bdi, BDI_RECLAIMABLE);
-				bdi_nr_writeback =
-					bdi_stat_sum(bdi, BDI_WRITEBACK);
-			} else {
-				bdi_nr_reclaimable =
-					bdi_stat(bdi, BDI_RECLAIMABLE);
-				bdi_nr_writeback =
-					bdi_stat(bdi, BDI_WRITEBACK);
-			}
+		/*
+		 * In order to avoid the stacked BDI deadlock we need
+		 * to ensure we accurately count the 'dirty' pages when
+		 * the threshold is low.
+		 *
+		 * Otherwise it would be possible to get thresh+n pages
+		 * reported dirty, even though there are thresh-m pages
+		 * actually dirty; with m+n sitting in the percpu
+		 * deltas.
+		 */
+		if (bdi_thresh < 2*bdi_stat_error(bdi)) {
+			bdi_nr_reclaimable = bdi_stat_sum(bdi, BDI_RECLAIMABLE);
+			bdi_nr_writeback = bdi_stat_sum(bdi, BDI_WRITEBACK);
+		} else if (bdi_nr_reclaimable) {
+			bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE);
+			bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK);
+		}
 
-			if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh)
-				break;
+		if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh)
+			break;
+		if (pages_written >= write_chunk)
+			break;		/* We've done our duty */
 
-			pages_written += write_chunk - wbc.nr_to_write;
-			if (pages_written >= write_chunk)
-				break;		/* We've done our duty */
-		}
 		congestion_wait(WRITE, HZ/10);
 	}
 
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.23-rc6-mm1, Andrew Morton, (Tue Sep 18, 1:18 am)
Re: 2.6.23-rc6-mm1, Andrew Morton, (Tue Sep 18, 1:24 am)
Re: 2.6.23-rc6-mm1, Kamalesh Babulal, (Tue Sep 18, 2:13 am)
Re: 2.6.23-rc6-mm1, Andrew Morton, (Tue Sep 18, 2:27 am)
Re: 2.6.23-rc6-mm1, Andy Whitcroft, (Tue Sep 18, 2:34 am)
Re: 2.6.23-rc6-mm1, Satyam Sharma, (Tue Sep 18, 2:34 am)
Re: 2.6.23-rc6-mm1, Benjamin Herrenschmidt, (Tue Sep 18, 3:02 am)
Re: 2.6.23-rc6-mm1, Kamalesh Babulal, (Tue Sep 18, 5:07 am)
Re: 2.6.23-rc6-mm1, Valdis.Kletnieks, (Tue Sep 18, 8:07 am)
Re: 2.6.23-rc6-mm1, Miles Lane, (Tue Sep 18, 8:27 am)
Re: 2.6.23-rc6-mm1, Miles Lane, (Tue Sep 18, 8:39 am)
modpost errors ( Re: 2.6.23-rc6-mm1), Gabriel C, (Tue Sep 18, 8:43 am)
Re: 2.6.23-rc6-mm1, Sam Ravnborg, (Tue Sep 18, 8:50 am)
Re: 2.6.23-rc6-mm1, Sam Ravnborg, (Tue Sep 18, 8:52 am)
Re: modpost errors ( Re: 2.6.23-rc6-mm1), Sam Ravnborg, (Tue Sep 18, 8:56 am)
Re: 2.6.23-rc6-mm1, Andrew Morton, (Tue Sep 18, 9:53 am)
Re: 2.6.23-rc6-mm1 (watchdog), Randy Dunlap, (Tue Sep 18, 10:18 am)
Re: 2.6.23-rc6-mm1, Miles Lane, (Tue Sep 18, 10:20 am)
Re: 2.6.23-rc6-mm1 (watchdog), Randy Dunlap, (Tue Sep 18, 10:41 am)
Re: 2.6.23-rc6-mm1, Mel Gorman, (Tue Sep 18, 10:44 am)
Re: 2.6.23-rc6-mm1, Mel Gorman, (Tue Sep 18, 11:05 am)
Re: 2.6.23-rc6-mm1, Greg KH, (Tue Sep 18, 12:16 pm)
Re: 2.6.23-rc6-mm1, Greg KH, (Tue Sep 18, 12:17 pm)
Re: 2.6.23-rc6-mm1, Sam Ravnborg, (Tue Sep 18, 12:17 pm)
2.6.23-rc6-mm1 - Mostly working, with a kbuild oddity, Valdis.Kletnieks, (Tue Sep 18, 12:32 pm)
Re: 2.6.23-rc6-mm1, Miles Lane, (Tue Sep 18, 12:42 pm)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, Rafael J. Wysocki, (Tue Sep 18, 1:21 pm)
Re: 2.6.23-rc6-mm1, Sam Ravnborg, (Tue Sep 18, 1:26 pm)
Re: 2.6.23-rc6-mm1 sparc build error, Mathieu Desnoyers, (Tue Sep 18, 1:54 pm)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, Rafael J. Wysocki, (Tue Sep 18, 1:54 pm)
Re: 2.6.23-rc6-mm1 sparc build error, Andrew Morton, (Tue Sep 18, 2:05 pm)
Re: 2.6.23-rc6-mm1, Benjamin Herrenschmidt, (Tue Sep 18, 2:35 pm)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Tue Sep 18, 2:37 pm)
Re: 2.6.23-rc6-mm1: atomic counter underflow, Mariusz Kozlowski, (Tue Sep 18, 2:45 pm)
Re: 2.6.23-rc6-mm1 - Mostly working, with a kbuild oddity, Valdis.Kletnieks, (Tue Sep 18, 3:03 pm)
Re: [v4l-dvb-maintainer] modpost errors ( Re: 2.6.23-rc6-mm1), Mauro Carvalho Chehab, (Tue Sep 18, 3:06 pm)
Re: 2.6.23-rc6-mm1, Gabriel C, (Tue Sep 18, 3:38 pm)
Re: 2.6.23-rc6-mm1, Gabriel C, (Tue Sep 18, 3:48 pm)
Re: 2.6.23-rc6-mm1 - Mostly working, with a kbuild oddity, Sam Ravnborg, (Wed Sep 19, 12:34 am)
Re: 2.6.23-rc6-mm1: atomic counter underflow, Cornelia Huck, (Wed Sep 19, 1:27 am)
2.6.23-rc6-mm1 -- powerpc link failure, Andy Whitcroft, (Wed Sep 19, 2:28 am)
X-freeze after clflush changes [Was: 2.6.23-rc6-mm1], Jiri Slaby, (Wed Sep 19, 4:43 am)
Re: 2.6.23-rc6-mm1 - Mostly working, with a kbuild oddity, Valdis.Kletnieks, (Wed Sep 19, 8:53 am)
2.6.23-rc6-mm1: kgdb support on ppc64 utterly broken, Mel Gorman, (Wed Sep 19, 9:29 am)
Re: 2.6.23-rc6-mm1 -- powerpc link failure, Segher Boessenkool, (Wed Sep 19, 9:36 am)
2.6.23-rc6-mm1 -- mkfs stuck in 'D', Andy Whitcroft, (Wed Sep 19, 9:43 am)
Re: 2.6.23-rc6-mm1: atomic counter underflow, Mariusz Kozlowski, (Wed Sep 19, 9:43 am)
Re: 2.6.23-rc6-mm1 -- powerpc link failure, Andy Whitcroft, (Wed Sep 19, 9:52 am)
Re: 2.6.23-rc6-mm1 - Mostly working, with a kbuild oddity, Sam Ravnborg, (Wed Sep 19, 10:39 am)
Re: 2.6.23-rc6-mm1 -- powerpc link failure, Sam Ravnborg, (Wed Sep 19, 10:44 am)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Wed Sep 19, 10:44 am)
Re: 2.6.23-rc6-mm1: atomic counter underflow, Cornelia Huck, (Wed Sep 19, 11:02 am)
Re: 2.6.23-rc6-mm1, Sam Ravnborg, (Wed Sep 19, 11:48 am)
Re: X-freeze after clflush changes [Was: 2.6.23-rc6-mm1], Andrew Morton, (Wed Sep 19, 12:10 pm)
Re: 2.6.23-rc6-mm1, Sam Ravnborg, (Wed Sep 19, 12:33 pm)
Re: 2.6.23-rc6-mm1 -- mkfs stuck in 'D', Hugh Dickins, (Wed Sep 19, 1:03 pm)
Re: X-freeze after clflush changes [Was: 2.6.23-rc6-mm1], Valdis.Kletnieks, (Wed Sep 19, 1:32 pm)
Re: 2.6.23-rc6-mm1, Gabriel C, (Wed Sep 19, 1:36 pm)
Re: 2.6.23-rc6-mm1, Sam Ravnborg, (Wed Sep 19, 1:43 pm)
Re: 2.6.23-rc6-mm1 -- mkfs stuck in 'D', Peter Zijlstra, (Wed Sep 19, 1:44 pm)
Re: X-freeze after clflush changes [Was: 2.6.23-rc6-mm1], Andrew Morton, (Wed Sep 19, 2:42 pm)
Re: 2.6.23-rc6-mm1, Tilman Schmidt, (Wed Sep 19, 4:02 pm)
Re: 2.6.23-rc6-mm1, Andrew Morton, (Wed Sep 19, 4:24 pm)
Re: 2.6.23-rc6-mm1, Chuck Ebbert, (Wed Sep 19, 4:28 pm)
Re: 2.6.23-rc6-mm1, David Brownell, (Wed Sep 19, 4:44 pm)
Re: 2.6.23-rc6-mm1, Tilman Schmidt, (Wed Sep 19, 4:55 pm)
Re: 2.6.23-rc6-mm1, Joseph Fannin, (Wed Sep 19, 4:58 pm)
Re: 2.6.23-rc6-mm1, Andrew Morton, (Wed Sep 19, 5:06 pm)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Wed Sep 19, 5:06 pm)
Re: 2.6.23-rc6-mm1, Andrew Morton, (Wed Sep 19, 5:09 pm)
Re: X-freeze after clflush changes [Was: 2.6.23-rc6-mm1], Andrew Morton, (Wed Sep 19, 7:24 pm)
Re: 2.6.23-rc6-mm1, David Brownell, (Wed Sep 19, 9:43 pm)
Re: 2.6.23-rc6-mm1, Andrew Morton, (Wed Sep 19, 11:11 pm)
Re: 2.6.23-rc6-mm1, Kay Sievers, (Thu Sep 20, 12:54 am)
Re: 2.6.23-rc6-mm1 - make access to tasks nsproxy ligther ..., Cedric Le Goater, (Thu Sep 20, 1:41 am)
Re: 2.6.23-rc6-mm1, Alessandro Zummo, (Thu Sep 20, 1:51 am)
Re: 2.6.23-rc6-mm1 - make access to tasks nsproxy ligther ..., Cedric Le Goater, (Thu Sep 20, 2:12 am)
Re: 2.6.23-rc6-mm1 -- mkfs stuck in 'D', Hugh Dickins, (Thu Sep 20, 4:31 am)
Re: 2.6.23-rc6-mm1 -- mkfs stuck in 'D', Peter Zijlstra, (Thu Sep 20, 5:15 am)
Re: 2.6.23-rc6-mm1 sparc build error, Guennadi Liakhovetski, (Thu Sep 20, 5:53 am)
Re: X-freeze after clflush changes [Was: 2.6.23-rc6-mm1], Valdis.Kletnieks, (Thu Sep 20, 6:17 am)
Build failure on ppc64 drivers/block/ps3disk.c, Mel Gorman, (Thu Sep 20, 6:25 am)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Thu Sep 20, 6:29 am)
Re: Build failure on ppc64 drivers/block/ps3disk.c, Jens Axboe, (Thu Sep 20, 6:32 am)
Re: 2.6.23-rc6-mm1: atomic counter underflow, Cornelia Huck, (Thu Sep 20, 6:35 am)
2.6.23-rc6-mm1: Build failures on ppc64_defconfig, Satyam Sharma, (Thu Sep 20, 6:37 am)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Thu Sep 20, 7:12 am)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Thu Sep 20, 7:47 am)
Re: 2.6.23-rc6-mm1, David Brownell, (Thu Sep 20, 9:15 am)
Re: 2.6.23-rc6-mm1: atomic counter underflow, Pierre Ossman, (Thu Sep 20, 9:30 am)
Re: 2.6.23-rc6-mm1 - make access to tasks nsproxy ligther ..., Cedric Le Goater, (Thu Sep 20, 10:08 am)
Re: kobject: Temporarily save k_name on cleanup for debug ..., Mariusz Kozlowski, (Thu Sep 20, 10:26 am)
Re: 2.6.23-rc6-mm1: atomic counter underflow, Mariusz Kozlowski, (Thu Sep 20, 10:27 am)
Re: 2.6.23-rc6-mm1, David Brownell, (Thu Sep 20, 10:36 am)
Re: 2.6.23-rc6-mm1, Tilman Schmidt, (Thu Sep 20, 12:10 pm)
Re: 2.6.23-rc6-mm1, Tilman Schmidt, (Thu Sep 20, 12:20 pm)
Re: 2.6.23-rc6-mm1, Andrew Morton, (Thu Sep 20, 1:25 pm)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Thu Sep 20, 1:39 pm)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Thu Sep 20, 1:42 pm)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Thu Sep 20, 2:45 pm)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Thu Sep 20, 2:54 pm)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Thu Sep 20, 3:30 pm)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Thu Sep 20, 3:35 pm)
Re: 2.6.23-rc6-mm1, Tilman Schmidt, (Thu Sep 20, 5:53 pm)
Re: [PATCH] Remove broken netfilter binary sysctls from br ..., Eric W. Biederman, (Thu Sep 20, 9:21 pm)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Fri Sep 21, 2:24 am)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Fri Sep 21, 2:25 am)
Re: 2.6.23-rc6-mm1 sparc build error, Mathieu Desnoyers, (Fri Sep 21, 6:51 am)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Fri Sep 21, 7:20 am)
Re: X-freeze after clflush changes [Was: 2.6.23-rc6-mm1], Valdis.Kletnieks, (Fri Sep 21, 10:16 am)
Re: X-freeze after clflush changes [Was: 2.6.23-rc6-mm1], Valdis.Kletnieks, (Fri Sep 21, 10:18 am)
Re: X-freeze after clflush changes [Was: 2.6.23-rc6-mm1], Valdis.Kletnieks, (Fri Sep 21, 10:54 am)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Fri Sep 21, 12:20 pm)
Re: X-freeze after clflush changes [Was: 2.6.23-rc6-mm1], Valdis.Kletnieks, (Fri Sep 21, 12:33 pm)
Re: 2.6.23-rc6-mm1: failure to boot on HP nx6325, no sound ..., Rafael J. Wysocki, (Fri Sep 21, 12:37 pm)
Re: 2.6.23-rc6-mm1 -- mkfs stuck in 'D', Fengguang Wu, (Fri Sep 21, 6:55 pm)
Re: 2.6.23-rc6-mm1: Build failures on ppc64_defconfig, Satyam Sharma, (Fri Sep 21, 11:50 pm)
Re: 2.6.23-rc6-mm1: Build failures on ppc64_defconfig, Satyam Sharma, (Fri Sep 21, 11:51 pm)
Re: 2.6.23-rc6-mm1: Build failures on ppc64_defconfig, Satyam Sharma, (Fri Sep 21, 11:54 pm)
Re: 2.6.23-rc6-mm1: Build failures on ppc64_defconfig, Satyam Sharma, (Sat Sep 22, 12:25 am)
[PATCH -mm] iseries_veth: Kill unused variable, Satyam Sharma, (Sat Sep 22, 12:55 am)
Re: 2.6.23-rc6-mm1, Satyam Sharma, (Sat Sep 22, 1:41 am)
Re: 2.6.23-rc6-mm1, Satyam Sharma, (Sat Sep 22, 2:21 am)
Re: 2.6.23-rc6-mm1 -- mkfs stuck in 'D', Peter Zijlstra, (Sat Sep 22, 6:16 am)
Re: 2.6.23-rc6-mm1 -- mkfs stuck in 'D', Fengguang Wu, (Sat Sep 22, 6:20 pm)
Re: 2.6.23-rc6-mm1 -- mkfs stuck in 'D', Peter Zijlstra, (Sun Sep 23, 6:02 am)
Re: 2.6.23-rc6-mm1 -- mkfs stuck in 'D', Fengguang Wu, (Sun Sep 23, 8:01 pm)
Re: X-freeze after clflush changes [Was: 2.6.23-rc6-mm1], Valdis.Kletnieks, (Sun Sep 23, 8:25 pm)
Re: 2.6.23-rc6-mm1 -- mkfs stuck in 'D', Peter Zijlstra, (Mon Sep 24, 12:35 am)
Re: X-freeze after clflush changes [Was: 2.6.23-rc6-mm1], Valdis.Kletnieks, (Mon Sep 24, 12:37 am)
Re: 2.6.23-rc6-mm1 -- mkfs stuck in 'D', Fengguang Wu, (Mon Sep 24, 1:12 am)
Re: 2.6.23-rc6-mm1, Mel Gorman, (Mon Sep 24, 4:14 am)
Re: [PATCH] Remove broken netfilter binary sysctls from br ..., Stephen Hemminger, (Mon Sep 24, 1:14 pm)
Re: 2.6.23-rc6-mm1, Greg KH, (Mon Sep 24, 10:35 pm)
Re: 2.6.23-rc6-mm1 -- powerpc link failure, Andy Whitcroft, (Tue Sep 25, 6:40 am)
Re: [PATCH] Remove broken netfilter binary sysctls from br ..., Eric W. Biederman, (Tue Sep 25, 7:03 am)
Re: [PATCH] Remove broken netfilter binary sysctls from br ..., Stephen Hemminger, (Tue Sep 25, 9:12 am)
Re: [PATCH] Remove broken netfilter binary sysctls from br ..., Eric W. Biederman, (Tue Sep 25, 9:38 am)