linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drop-behind fix for generic_file_write
@ 2001-01-03 14:57 Rik van Riel
  2001-01-03 15:21 ` Daniel Phillips
  2001-01-03 15:21 ` Rik van Riel
  0 siblings, 2 replies; 3+ messages in thread
From: Rik van Riel @ 2001-01-03 14:57 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Alan Cox, linux-kernel, linux-mm

Hi Linus, Alan,

the following (trivial) patch fixes drop-behind behaviour
in generic_file_write to only drop fully written pages.

This increases performance in dbench by about 8% (as
measured by Daniel Phillips) and should get rid of the
logfile bottleneck Ingo Molnar found with the drop-behind
call in generic_file_write in TUX tests.

Please apply this (trivial) patch for 2.4.0.

regards,

Rik
--
Hollywood goes for world dumbination,
	Trailer at 11.

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/



--- linux-2.4.0-prerelease/mm/filemap.c.orig	Wed Jan  3 12:52:13 2001
+++ linux-2.4.0-prerelease/mm/filemap.c	Wed Jan  3 12:54:05 2001
@@ -2496,7 +2496,7 @@
 	}
 
 	while (count) {
-		unsigned long bytes, index, offset;
+		unsigned long bytes, index, offset, partial = 0;
 		char *kaddr;
 
 		/*
@@ -2506,8 +2506,10 @@
 		offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */
 		index = pos >> PAGE_CACHE_SHIFT;
 		bytes = PAGE_CACHE_SIZE - offset;
-		if (bytes > count)
+		if (bytes > count) {
 			bytes = count;
+			partial = 1;
+		}
 
 		/*
 		 * Bring in the user page that we will copy from _first_.
@@ -2549,9 +2551,17 @@
 			buf += status;
 		}
 unlock:
-		/* Mark it unlocked again and drop the page.. */
+		/*
+		 * Mark it unlocked again and release the page.
+		 * In order to prevent large (fast) file writes
+		 * from causing too much memory pressure we move
+		 * completely written pages to the inactive list.
+		 * We do, however, try to keep the pages that may
+		 * still be written to (ie. partially written pages).
+		 */
 		UnlockPage(page);
-		deactivate_page(page);
+		if (!partial)
+			deactivate_page(page);
 		page_cache_release(page);
 
 		if (status < 0)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

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

* Re: [PATCH] drop-behind fix for generic_file_write
  2001-01-03 14:57 [PATCH] drop-behind fix for generic_file_write Rik van Riel
@ 2001-01-03 15:21 ` Daniel Phillips
  2001-01-03 15:21 ` Rik van Riel
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Phillips @ 2001-01-03 15:21 UTC (permalink / raw)
  To: Rik van Riel, Linus Torvalds; +Cc: Alan Cox, linux-kernel, linux-mm

On Wed, 03 Jan 2001, Rik van Riel wrote:
> Hi Linus, Alan,
> 
> the following (trivial) patch fixes drop-behind behaviour
> in generic_file_write to only drop fully written pages.
> 
> This increases performance in dbench by about 8% (as
> measured by Daniel Phillips) and should get rid of the
> logfile bottleneck Ingo Molnar found with the drop-behind
> call in generic_file_write in TUX tests.

Rik, I detected the speedup in -pre5 but it disappeared in -pre7 (which
turned in a faster performance than pre5 or 6 anyway).  I don't have an
explanation for that.  The idea makes sense: treat a partial page as
'in play' until completely full, then deactivate it.

-- 
Daniel
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

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

* Re: [PATCH] drop-behind fix for generic_file_write
  2001-01-03 14:57 [PATCH] drop-behind fix for generic_file_write Rik van Riel
  2001-01-03 15:21 ` Daniel Phillips
@ 2001-01-03 15:21 ` Rik van Riel
  1 sibling, 0 replies; 3+ messages in thread
From: Rik van Riel @ 2001-01-03 15:21 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Alan Cox, linux-kernel, linux-mm

On Wed, 3 Jan 2001, Rik van Riel wrote:

> the following (trivial) patch fixes drop-behind behaviour
> in generic_file_write to only drop fully written pages.

OK, please ignore. It is already in  prerelease-diff
in the testing/ directory .. ;)

regards,

Rik
--
Hollywood goes for world dumbination,
	Trailer at 11.

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

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

end of thread, other threads:[~2001-01-03 15:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-03 14:57 [PATCH] drop-behind fix for generic_file_write Rik van Riel
2001-01-03 15:21 ` Daniel Phillips
2001-01-03 15:21 ` Rik van Riel

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