

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 |    7 +++++++
 1 files changed, 7 insertions(+)

diff -puN mm/mmap.c~mmap-prefault mm/mmap.c
--- 25/mm/mmap.c~mmap-prefault	2003-05-31 19:56:41.000000000 -0700
+++ 25-akpm/mm/mmap.c	2003-05-31 19:56:41.000000000 -0700
@@ -740,6 +740,13 @@ out:	
 		sys_remap_file_pages(addr, len, prot,
 					pgoff, flags & MAP_NONBLOCK);
 		down_write(&mm->mmap_sem);
+	} else if (file && (prot & PROT_EXEC)) { /* prefault executables */
+		struct address_space *mapping;
+
+		mapping = file->f_dentry->d_inode->i_mapping;
+		if (mapping && len < 8 * 1024 * 1024)	/* whee */
+			do_page_cache_readahead(mapping, file, pgoff,
+						len >> PAGE_CACHE_SHIFT);
 	}
 	return addr;
 

_
