[PATCH] MAX_READAHEAD gives doubled throuput

Roger Larsson (roger.larsson@norran.net)
Sat, 28 Jul 2001 03:40:49 +0200


Hi all,

Got wondering why simultaneous streaming is so much slower than normal...

Are there any reasons nowadays why we should not attempt to read ahead more
than 31 pages at once?

31 pages equals 0.1 MB, it is read from the HD in 4 ms => very close to the
average access times. Resulting in a maximum of half the possible speed.

With this patch copy and diff throughput are increased from 14 respective 11
MB/s to 27 and 28 !!!

I enable the profiling as well... (one printk warning fixed)

/RogerL

*******************************************
Patch prepared by: roger.larsson@norran.net

--- linux/mm/filemap.c.orig Fri Jul 27 21:31:41 2001
+++ linux/mm/filemap.c Sat Jul 28 03:01:05 2001
@@ -744,10 +744,8 @@
return NULL;
}

-#if 0
#define PROFILE_READAHEAD
#define DEBUG_READAHEAD
-#endif

/*
* Read-ahead profiling information
@@ -791,13 +789,13 @@
}

printk("Readahead average: max=%ld, len=%ld, win=%ld, async=%ld%%\n",
- total_ramax/total_reada,
- total_ralen/total_reada,
- total_rawin/total_reada,
- (total_async*100)/total_reada);
+ total_ramax/total_reada,
+ total_ralen/total_reada,
+ total_rawin/total_reada,
+ (total_async*100)/total_reada);
#ifdef DEBUG_READAHEAD
- printk("Readahead snapshot: max=%ld, len=%ld, win=%ld, raend=%Ld\n",
- filp->f_ramax, filp->f_ralen, filp->f_rawin, filp->f_raend);
+ printk("Readahead snapshot: max=%ld, len=%ld, win=%ld, raend=%ld\n",
+ filp->f_ramax, filp->f_ralen, filp->f_rawin, filp->f_raend);
#endif

total_reada = 0;
--- linux/include/linux/blkdev.h.orig Fri Jul 27 21:36:37 2001
+++ linux/include/linux/blkdev.h Sat Jul 28 02:51:10 2001
@@ -184,7 +184,7 @@
#define PageAlignSize(size) (((size) + PAGE_SIZE -1) & PAGE_MASK)

/* read-ahead in pages.. */
-#define MAX_READAHEAD 31
+#define MAX_READAHEAD 511
#define MIN_READAHEAD 3

#define blkdev_entry_to_request(entry) list_entry((entry), struct request,
queue)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/