public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] Prefetching file_read_actor()
@ 2001-12-31  3:32 Dave Jones
  2001-12-31  5:44 ` Andrew Morton
  2001-12-31 12:50 ` Rik van Riel
  0 siblings, 2 replies; 14+ messages in thread
From: Dave Jones @ 2001-12-31  3:32 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Manfred Spraul

After noticing file_read_actor() showing up in profiles quite
a bit, I grepped old l-k messages, and turned up a post by
Manfred Spraul in which he posted a patch using inline asm
to prefetch read data.  This was x86 specific in generic code,
so was a little hackish..
Now that we have the prefetch macros, I decided to play with
this a little tonight, and came up with this patch..


diff -urN --exclude-from=/home/davej/.exclude linux-2.5.2-pre5/mm/filemap.c linux-2.5/mm/filemap.c
--- linux-2.5.2-pre5/mm/filemap.c	Sun Dec 16 23:21:24 2001
+++ linux-2.5/mm/filemap.c	Mon Dec 31 03:22:51 2001
@@ -1570,6 +1570,15 @@
 		size = count;
 
 	kaddr = kmap(page);
+
+	if (size > 128) {
+		int i;
+		for(i=0; i<size; i+=64) {
+			prefetch (kaddr+offset);
+			prefetch (kaddr+offset+(L1_CACHE_BYTES*2));
+		}
+	}
+
 	left = __copy_to_user(desc->buf, kaddr + offset, size);
 	kunmap(page);
 	
The results are an earth shaking 5 seconds off a make dep bzImage
on my P3, I've not benched an Athlon (or other prefetch aware
architecture) yet, but I expect to see similar speed ups..

Comments ?

Dave.

-- 
Dave Jones.                    http://www.codemonkey.org.uk
SuSE Labs.

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

end of thread, other threads:[~2002-01-01 15:16 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-31  3:32 [patch] Prefetching file_read_actor() Dave Jones
2001-12-31  5:44 ` Andrew Morton
2001-12-31 10:58   ` Manfred Spraul
2001-12-31 19:28     ` Andrew Morton
2001-12-31 19:47       ` Dave Jones
2001-12-31 20:40         ` Ryan Cumming
2002-01-01 10:29         ` Alan Cox
2002-01-01 12:45           ` Dave Jones
2002-01-01 15:26             ` Alan Cox
2002-01-01 10:30       ` Alan Cox
2002-01-01 11:08         ` Anton Blanchard
2001-12-31 20:31     ` Dave Jones
2001-12-31 13:00   ` Alan Cox
2001-12-31 12:50 ` 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