From: Wu Fengguang <fengguang.wu@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jens Axboe <jens.axboe@oracle.com>, Ingo Molnar <mingo@elte.hu>,
Steven Rostedt <rostedt@goodmis.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Rik van Riel <riel@redhat.com>,
Wu Fengguang <fengguang.wu@intel.com>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Olivier Galibert <galibert@pobox.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Linux Memory Management List <linux-mm@kvack.org>
Cc: <linux-fsdevel@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 10/16] readahead: add tracing event
Date: Mon, 01 Mar 2010 13:27:01 +0800 [thread overview]
Message-ID: <20100301053621.672250519@intel.com> (raw)
In-Reply-To: 20100301052651.857984880@intel.com
[-- Attachment #1: readahead-tracer.patch --]
[-- Type: text/plain, Size: 4414 bytes --]
Example output:
# echo 1 > /debug/tracing/events/readahead/enable
# cp test-file /dev/null
# cat /debug/tracing/trace # trimmed output
readahead-initial(dev=0:15, ino=100177, req=0+2, ra=0+4-2, async=0) = 4
readahead-subsequent(dev=0:15, ino=100177, req=2+2, ra=4+8-8, async=1) = 8
readahead-subsequent(dev=0:15, ino=100177, req=4+2, ra=12+16-16, async=1) = 16
readahead-subsequent(dev=0:15, ino=100177, req=12+2, ra=28+32-32, async=1) = 32
readahead-subsequent(dev=0:15, ino=100177, req=28+2, ra=60+60-60, async=1) = 24
readahead-subsequent(dev=0:15, ino=100177, req=60+2, ra=120+60-60, async=1) = 0
CC: Ingo Molnar <mingo@elte.hu>
CC: Jens Axboe <jens.axboe@oracle.com>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
include/trace/events/readahead.h | 78 +++++++++++++++++++++++++++++
mm/readahead.c | 11 ++++
2 files changed, 89 insertions(+)
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux/include/trace/events/readahead.h 2010-02-26 10:09:48.000000000 +0800
@@ -0,0 +1,78 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM readahead
+
+#if !defined(_TRACE_READAHEAD_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_READAHEAD_H
+
+#include <linux/tracepoint.h>
+
+#define show_pattern_name(val) \
+ __print_symbolic(val, \
+ { RA_PATTERN_INITIAL, "initial" }, \
+ { RA_PATTERN_SUBSEQUENT, "subsequent" }, \
+ { RA_PATTERN_CONTEXT, "context" }, \
+ { RA_PATTERN_THRASH, "thrash" }, \
+ { RA_PATTERN_MMAP_AROUND, "around" }, \
+ { RA_PATTERN_FADVISE, "fadvise" }, \
+ { RA_PATTERN_RANDOM, "random" }, \
+ { RA_PATTERN_ALL, "all" })
+
+/*
+ * Tracepoint for guest mode entry.
+ */
+TRACE_EVENT(readahead,
+ TP_PROTO(struct address_space *mapping,
+ pgoff_t offset,
+ unsigned long req_size,
+ unsigned int ra_flags,
+ pgoff_t start,
+ unsigned int size,
+ unsigned int async_size,
+ unsigned int actual),
+
+ TP_ARGS(mapping, offset, req_size,
+ ra_flags, start, size, async_size, actual),
+
+ TP_STRUCT__entry(
+ __field( dev_t, dev )
+ __field( ino_t, ino )
+ __field( pgoff_t, offset )
+ __field( unsigned long, req_size )
+ __field( unsigned int, pattern )
+ __field( pgoff_t, start )
+ __field( unsigned int, size )
+ __field( unsigned int, async_size )
+ __field( unsigned int, actual )
+ ),
+
+ TP_fast_assign(
+ __entry->dev = mapping->host->i_sb->s_dev;
+ __entry->ino = mapping->host->i_ino;
+ __entry->pattern = ra_pattern(ra_flags);
+ __entry->offset = offset;
+ __entry->req_size = req_size;
+ __entry->start = start;
+ __entry->size = size;
+ __entry->async_size = async_size;
+ __entry->actual = actual;
+ ),
+
+ TP_printk("readahead-%s(dev=%d:%d, ino=%lu, "
+ "req=%lu+%lu, ra=%lu+%d-%d, async=%d) = %d",
+ show_pattern_name(__entry->pattern),
+ MAJOR(__entry->dev),
+ MINOR(__entry->dev),
+ __entry->ino,
+ __entry->offset,
+ __entry->req_size,
+ __entry->start,
+ __entry->size,
+ __entry->async_size,
+ __entry->start > __entry->offset,
+ __entry->actual)
+);
+
+#endif /* _TRACE_READAHEAD_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
--- linux.orig/mm/readahead.c 2010-02-26 10:09:47.000000000 +0800
+++ linux/mm/readahead.c 2010-02-26 10:10:05.000000000 +0800
@@ -41,6 +41,9 @@
#include <linux/pagevec.h>
#include <linux/pagemap.h>
+#define CREATE_TRACE_POINTS
+#include <trace/events/readahead.h>
+
/*
* Set async size to 1/# of the thrashing threshold.
*/
@@ -320,6 +323,11 @@ int force_page_cache_readahead(struct ad
offset += this_chunk;
nr_to_read -= this_chunk;
}
+
+ trace_readahead(mapping, offset, nr_to_read,
+ RA_PATTERN_FADVISE << READAHEAD_PATTERN_SHIFT,
+ offset, nr_to_read, 0, ret);
+
return ret;
}
@@ -347,6 +355,9 @@ unsigned long ra_submit(struct file_ra_s
actual = __do_page_cache_readahead(mapping, filp,
ra->start, ra->size, ra->async_size);
+ trace_readahead(mapping, offset, req_size, ra->ra_flags,
+ ra->start, ra->size, ra->async_size, actual);
+
return actual;
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-03-01 5:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-01 5:26 [PATCH 00/16] [PATCH 00/15] 512K readahead size with thrashing safe readahead v3 Wu Fengguang
2010-03-01 5:26 ` [PATCH 01/16] readahead: limit readahead size for small devices Wu Fengguang
2010-03-01 5:26 ` [PATCH 02/16] readahead: retain inactive lru pages to be accessed soon Wu Fengguang
2010-03-01 5:26 ` [PATCH 03/16] readahead: bump up the default readahead size Wu Fengguang
2010-03-01 5:26 ` [PATCH 04/16] readahead: make default readahead size a kernel parameter Wu Fengguang
2010-03-01 5:26 ` [PATCH 05/16] readahead: limit read-ahead size for small memory systems Wu Fengguang
2010-03-01 5:26 ` [PATCH 06/16] readahead: add notes on readahead size Wu Fengguang
2010-03-01 5:26 ` [PATCH 07/16] readahead: replace ra->mmap_miss with ra->ra_flags Wu Fengguang
2010-03-01 5:26 ` [PATCH 08/16] readahead: thrashing safe context readahead Wu Fengguang
2010-03-01 5:27 ` [PATCH 09/16] readahead: record readahead patterns Wu Fengguang
2010-03-01 5:27 ` Wu Fengguang [this message]
2010-03-01 5:27 ` [PATCH 11/16] readahead: add /debug/readahead/stats Wu Fengguang
2010-03-01 5:27 ` [PATCH 12/16] readahead: dont do start-of-file readahead after lseek() Wu Fengguang
2010-03-01 5:27 ` [PATCH 13/16] radixtree: introduce radix_tree_lookup_leaf_node() Wu Fengguang
2010-03-01 5:27 ` [PATCH 14/16] radixtree: speed up the search for hole Wu Fengguang
2010-03-01 5:27 ` [PATCH 15/16] readahead: reduce MMAP_LOTSAMISS for mmap read-around Wu Fengguang
2010-03-01 5:27 ` [PATCH 16/16] readahead: pagecache context based " Wu Fengguang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100301053621.672250519@intel.com \
--to=fengguang.wu@intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=jens.axboe@oracle.com \
--cc=mingo@elte.hu \
--cc=riel@redhat.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).