The patch titled readahead: debug traces showing read patterns has been added to the -mm tree. Its filename is readahead-debug-traces-showing-read-patterns.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: readahead: debug traces showing read patterns From: Wu Fengguang <wfg@xxxxxxxxxxxxxxxx> Print all relavant read requests to help discover the access pattern. If you are experiencing performance problems, or want to help improve the read-ahead logic, please send me the trace data. Thanks. - Preparations # Compile kernel with option CONFIG_DEBUG_READAHEAD mkdir /debug mount -t debug none /debug - For each session with distinct access pattern echo > /debug/readahead # reset the counters # echo > /var/log/kern.log # you may want to backup it first echo 8 > /debug/readahead/debug_level # show verbose printk traces # do one benchmark/task echo 0 > /debug/readahead/debug_level # revert to normal value cp /debug/readahead/events readahead-events-`date +'%F_%R'` bzip2 -c /var/log/kern.log > kern.log-`date +'%F_%R'`.bz2 Signed-off-by: Wu Fengguang <wfg@xxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- mm/filemap.c | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletion(-) diff -puN mm/filemap.c~readahead-debug-traces-showing-read-patterns mm/filemap.c --- 25/mm/filemap.c~readahead-debug-traces-showing-read-patterns Fri May 26 13:34:50 2006 +++ 25-akpm/mm/filemap.c Fri May 26 13:34:50 2006 @@ -45,6 +45,12 @@ static ssize_t generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs); +#ifdef CONFIG_DEBUG_READAHEAD +extern u32 debug_level; +#else +#define debug_level 0 +#endif /* CONFIG_DEBUG_READAHEAD */ + /* * Shared mappings implemented 30.11.1994. It's not fully working yet, * though. @@ -847,6 +853,10 @@ void do_generic_mapping_read(struct addr if (!isize) goto out; + if (debug_level >= 5) + printk(KERN_DEBUG "read-file(ino=%lu, req=%lu+%lu)\n", + inode->i_ino, index, last_index - index); + end_index = (isize - 1) >> PAGE_CACHE_SHIFT; for (;;) { struct page *page; @@ -901,6 +911,11 @@ find_page: if (prefer_adaptive_readahead()) readahead_cache_hit(&ra, page); + if (debug_level >= 7) + printk(KERN_DEBUG "read-page(ino=%lu, idx=%lu, io=%s)\n", + inode->i_ino, index, + PageUptodate(page) ? "hit" : "miss"); + if (!PageUptodate(page)) goto page_not_up_to_date; page_ok: @@ -1352,7 +1367,6 @@ retry_all: if (!prefer_adaptive_readahead() && VM_SequentialReadHint(area)) page_cache_readahead(mapping, ra, file, pgoff, 1); - /* * Do we have something in the page cache already? */ @@ -1415,6 +1429,13 @@ retry_find: if (prefer_adaptive_readahead()) readahead_cache_hit(ra, page); + if (debug_level >= 6) + printk(KERN_DEBUG "read-mmap(ino=%lu, idx=%lu, hint=%s, io=%s)\n", + inode->i_ino, pgoff, + VM_RandomReadHint(area) ? "random" : + (VM_SequentialReadHint(area) ? "sequential" : "none"), + PageUptodate(page) ? "hit" : "miss"); + /* * Ok, found a page in the page cache, now we need to check * that it's up-to-date. _ Patches currently in -mm which might be from wfg@xxxxxxxxxxxxxxxx are readahead-kconfig-options.patch radixtree-introduce-__radix_tree_lookup_parent.patch radixtree-introduce-radix_tree_scan_hole.patch mm-introduce-probe_pages.patch mm-introduce-pg_readahead.patch readahead-add-look-ahead-support-to-__do_page_cache_readahead.patch readahead-delay-page-release-in-do_generic_mapping_read.patch readahead-insert-cond_resched-calls.patch readahead-minmax_ra_pages.patch readahead-events-accounting.patch readahead-rescue_pages.patch readahead-sysctl-parameters.patch readahead-min-max-sizes.patch readahead-state-based-method-aging-accounting.patch readahead-state-based-method-routines.patch readahead-state-based-method.patch readahead-context-based-method.patch readahead-initial-method-guiding-sizes.patch readahead-initial-method-thrashing-guard-size.patch readahead-initial-method-expected-read-size.patch readahead-initial-method-user-recommended-size.patch readahead-initial-method.patch readahead-backward-prefetching-method.patch readahead-seeking-reads-method.patch readahead-thrashing-recovery-method.patch readahead-call-scheme.patch readahead-laptop-mode.patch readahead-loop-case.patch readahead-nfsd-case.patch readahead-turn-on-by-default.patch readahead-debug-radix-tree-new-functions.patch readahead-debug-traces-showing-accessed-file-names.patch readahead-debug-traces-showing-read-patterns.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html