From mboxrd@z Thu Jan 1 00:00:00 1970 From: compudj@krystal.dyndns.org (Mathieu Desnoyers) Date: Wed, 4 Feb 2009 00:56:33 -0500 Subject: [ltt-dev] [PATCH] Add tracepoints to track pagecache transition In-Reply-To: <4988EA61.60508@bk.jp.nec.com> References: <4987DF60.9030504@bk.jp.nec.com> <20090203140702.GB9620@Krystal> <20090203141646.GD9620@Krystal> <4988EA61.60508@bk.jp.nec.com> Message-ID: <20090204055633.GA10772@Krystal> * Atsushi Tsuji (a-tsuji at bk.jp.nec.com) wrote: > Mathieu Desnoyers wrote: > > * Mathieu Desnoyers (compudj at krystal.dyndns.org) wrote: > >> * Atsushi Tsuji (a-tsuji at bk.jp.nec.com) wrote: > >>> Hi, > >>> > >>> I thought it would be useful to trace pagecache behavior for problem > >>> analysis (performance bottlenecks, behavior differences between stable > >>> time and trouble time). > >>> > >>> By using those tracepoints, we can describe and visualize pagecache > >>> transition (file-by-file basis) in kernel and pagecache > >>> consumes most of the memory in running system and pagecache hit rate > >>> and writeback behavior will influence system load and performance. > >>> > >>> I attached an example which is visualization of pagecache status using > >>> SystemTap. That graph describes pagecache transition of File A and File B > >>> on a file-by-file basis with the situation where regular I/O to File A > >>> is delayed because of other I/O to File B. We visually understand > >>> pagecache for File A is narrowed down due to I/O pressure from File B. > >>> > >>> The below patch is for lttng tree to add those new tracepoints. > >>> > >> Hi Atsushi, > >> > >> Great patch ! > >> > >> I'll merge it into the next LTTng release. > >> > > > > -EDOESNOTAPPLY > > > > Please make sure your email client is correctly configured and try to > > resend this patch. See Documentation/email-clients.txt for more > > information. > > > > Hi Mathieu, > > Sorry for wrong patch. I resend fixed one. > Merged, thanks ! Mathieu > Signed-off-by: Atsushi Tsuji > --- > diff --git a/include/trace/filemap.h b/include/trace/filemap.h > index 0d881a1..454d908 100644 > --- a/include/trace/filemap.h > +++ b/include/trace/filemap.h > @@ -9,5 +9,11 @@ DECLARE_TRACE(wait_on_page_start, > DECLARE_TRACE(wait_on_page_end, > TPPROTO(struct page *page, int bit_nr), > TPARGS(page, bit_nr)); > +DECLARE_TRACE(add_to_page_cache, > + TPPROTO(struct address_space *mapping, pgoff_t offset), > + TPARGS(mapping, offset)); > +DECLARE_TRACE(remove_from_page_cache, > + TPPROTO(struct address_space *mapping), > + TPARGS(mapping)); > > #endif > diff --git a/ltt/probes/mm-trace.c b/ltt/probes/mm-trace.c > index 2b60d89..b3122c9 100644 > --- a/ltt/probes/mm-trace.c > +++ b/ltt/probes/mm-trace.c > @@ -164,6 +164,22 @@ void probe_swap_file_open(struct file *file, char *filename) > } > #endif > > +void probe_add_to_page_cache(struct address_space *mapping, pgoff_t offset) > +{ > + trace_mark_tp(mm, add_to_page_cache, add_to_page_cache, > + probe_add_to_page_cache, > + "inode %lu sdev %u", > + mapping->host->i_ino, mapping->host->i_sb->s_dev); > +} > + > +void probe_remove_from_page_cache(struct address_space *mapping) > +{ > + trace_mark_tp(mm, remove_from_page_cache, remove_from_page_cache, > + probe_remove_from_page_cache, > + "inode %lu sdev %u", > + mapping->host->i_ino, mapping->host->i_sb->s_dev); > +} > + > MODULE_LICENSE("GPL"); > MODULE_AUTHOR("Mathieu Desnoyers"); > MODULE_DESCRIPTION("MM Tracepoint Probes"); > diff --git a/mm/filemap.c b/mm/filemap.c > index cca96ed..7f3fbcf 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -45,6 +45,8 @@ > > DEFINE_TRACE(wait_on_page_start); > DEFINE_TRACE(wait_on_page_end); > +DEFINE_TRACE(add_to_page_cache); > +DEFINE_TRACE(remove_from_page_cache); > > /* > * Shared mappings implemented 30.11.1994. It's not fully working yet, > @@ -123,6 +125,7 @@ void __remove_from_page_cache(struct page *page) > page->mapping = NULL; > mapping->nrpages--; > __dec_zone_page_state(page, NR_FILE_PAGES); > + trace_remove_from_page_cache(mapping); > BUG_ON(page_mapped(page)); > > /* > @@ -477,6 +480,7 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping, > if (likely(!error)) { > mapping->nrpages++; > __inc_zone_page_state(page, NR_FILE_PAGES); > + trace_add_to_page_cache(mapping, offset); > } else { > page->mapping = NULL; > mem_cgroup_uncharge_cache_page(page); > > > _______________________________________________ > ltt-dev mailing list > ltt-dev at lists.casi.polymtl.ca > http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev > -- Mathieu Desnoyers OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68