linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] count for buffer IO in page_launder()
@ 2001-02-27  7:09 Marcelo Tosatti
  0 siblings, 0 replies; only message in thread
From: Marcelo Tosatti @ 2001-02-27  7:09 UTC (permalink / raw)
  To: Alan Cox, Rik van Riel; +Cc: lkml, linux-mm


Hi,

page_launder() is not counting direct ll_rw_block() IO correctly in the
flushed pages counter. 

A page is only counted as flushed if it had its buffer_head's freed,
meaning that pages which have been queued but not freed are not counted.

The following patch against ac5 fixes the problem.



diff -Nur linux.orig/mm/vmscan.c linux/mm/vmscan.c
--- linux.orig/mm/vmscan.c	Sat Feb 24 23:30:20 2001
+++ linux/mm/vmscan.c	Mon Feb 26 05:45:08 2001
@@ -535,7 +535,7 @@
 		 * buffer pages
 		 */
 		if (page->buffers) {
-			int wait, clearedbuf;
+			int wait;
 			/*
 			 * Since we might be doing disk IO, we have to
 			 * drop the spinlock and take an extra reference
@@ -554,7 +554,8 @@
 				wait = 0;	/* No IO */
 
 			/* Try to free the page buffers. */
-			clearedbuf = try_to_free_buffers(page, wait);
+			if (try_to_free_buffers(page, wait))
+				flushed_pages++;
 
 			/*
 			 * Re-take the spinlock. Note that we cannot
@@ -564,10 +565,8 @@
 			spin_lock(&pagemap_lru_lock);
 
 			/* The buffers were not freed. */
-			if (!clearedbuf) {
+			if (page->buffers) {
 				add_page_to_inactive_dirty_list(page);
-				if (wait)
-					flushed_pages++;
 
 			/* The page was only in the buffer cache. */
 			} else if (!page->mapping) {
diff -Nur linux.orig/fs/buffer.c linux/fs/buffer.c
--- linux.orig/fs/buffer.c	Sat Feb 24 23:30:16 2001
+++ linux/fs/buffer.c	Mon Feb 26 04:44:54 2001
@@ -1399,7 +1399,8 @@
 	 * instead.
 	 */
 	if (!offset) {
-		if (!try_to_free_buffers(page, 0)) {
+		try_to_free_buffers(page, 0)
+		if (page->buffers) {
 			atomic_inc(&buffermem_pages);
 			return 0;
 		}
@@ -2413,7 +2414,7 @@
 	spin_unlock(&free_list[index].lock);
 	write_unlock(&hash_table_lock);
 	spin_unlock(&lru_list_lock);
-	return 1;
+	return 0;
 
 busy_buffer_page:
 	/* Uhhuh, start writeback so that we don't end up with all dirty pages */
@@ -2428,6 +2429,7 @@
 			goto cleaned_buffers_try_again;
 		}
 		wakeup_bdflush(0);
+		return 1;
 	}
 	return 0;
 }







^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-02-27  8:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-27  7:09 [PATCH] count for buffer IO in page_launder() Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).