Faulting in executables creates crappy disk IO patterns.  Add a little hack
to pull these mappings into pagecache in a nice slurp.



 mm/mmap.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+)

diff -puN mm/mmap.c~mmap-prefault mm/mmap.c
--- 25/mm/mmap.c~mmap-prefault	2003-06-05 21:55:59.000000000 -0700
+++ 25-akpm/mm/mmap.c	2003-06-05 22:00:26.000000000 -0700
@@ -740,6 +740,21 @@ out:	
 		sys_remap_file_pages(addr, len, prot,
 					pgoff, flags & MAP_NONBLOCK);
 		down_write(&mm->mmap_sem);
+	} else if (file && (prot & PROT_EXEC)) {
+		struct address_space *mapping;
+
+		/*
+		 * executable prefaulting.  Avoid doing it if it looks like
+		 * there's a huge amount of data involved, or if it is likely
+		 * that everything we want is in pagecache anyway.
+		 */
+		mapping = file->f_dentry->d_inode->i_mapping;
+		if (	mapping &&
+			((len >> PAGE_CACHE_SHIFT) > mapping->nrpages) &&
+			(len < 8 * 1024 * 1024)) {
+			do_page_cache_readahead(mapping, file, pgoff,
+						len >> PAGE_CACHE_SHIFT);
+		}
 	}
 	return addr;
 

_