public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Add tracepoints to track pagecache transition
@ 2009-02-03  7:50 Atsushi Tsuji
  2009-02-03 16:42 ` [ltt-dev] " Mathieu Desnoyers
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Atsushi Tsuji @ 2009-02-03  7:50 UTC (permalink / raw)
  To: mathieu.desnoyers, ltt-dev; +Cc: systemtap, Kazuto Miyoshi

[-- Attachment #1: Type: text/plain, Size: 3220 bytes --]

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.

Signed-off-by: Atsushi Tsuji <a-tsuji@bk.jp.nec.com>
---
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);



[-- Attachment #2: pgcache.jpg --]
[-- Type: image/jpeg, Size: 38334 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ltt-dev] [PATCH] Add tracepoints to track pagecache transition
  2009-02-03  7:50 [PATCH] Add tracepoints to track pagecache transition Atsushi Tsuji
@ 2009-02-03 16:42 ` Mathieu Desnoyers
  2009-02-03 19:03   ` Mathieu Desnoyers
  2009-02-05  8:03 ` Frank Ch. Eigler
  2009-02-11 16:31 ` Mathieu Desnoyers
  2 siblings, 1 reply; 8+ messages in thread
From: Mathieu Desnoyers @ 2009-02-03 16:42 UTC (permalink / raw)
  To: Atsushi Tsuji; +Cc: ltt-dev, Kazuto Miyoshi, systemtap

* Atsushi Tsuji (a-tsuji@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.

Thanks,

Mathieu

> Signed-off-by: Atsushi Tsuji <a-tsuji@bk.jp.nec.com>
> ---
> 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@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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ltt-dev] [PATCH] Add tracepoints to track pagecache transition
  2009-02-03 16:42 ` [ltt-dev] " Mathieu Desnoyers
@ 2009-02-03 19:03   ` Mathieu Desnoyers
  2009-02-04  2:56     ` Atsushi Tsuji
  0 siblings, 1 reply; 8+ messages in thread
From: Mathieu Desnoyers @ 2009-02-03 19:03 UTC (permalink / raw)
  To: Atsushi Tsuji; +Cc: systemtap, ltt-dev, Kazuto Miyoshi

* Mathieu Desnoyers (compudj@krystal.dyndns.org) wrote:
> * Atsushi Tsuji (a-tsuji@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.

Thanks,

Mathieu


> Thanks,
> 
> Mathieu
> 
> > Signed-off-by: Atsushi Tsuji <a-tsuji@bk.jp.nec.com>
> > ---
> > 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@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
> 
> _______________________________________________
> ltt-dev mailing list
> ltt-dev@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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ltt-dev] [PATCH] Add tracepoints to track pagecache transition
  2009-02-03 19:03   ` Mathieu Desnoyers
@ 2009-02-04  2:56     ` Atsushi Tsuji
  2009-02-04 11:44       ` Mathieu Desnoyers
  0 siblings, 1 reply; 8+ messages in thread
From: Atsushi Tsuji @ 2009-02-04  2:56 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: systemtap, ltt-dev, Kazuto Miyoshi

Mathieu Desnoyers wrote:
> * Mathieu Desnoyers (compudj@krystal.dyndns.org) wrote:
>> * Atsushi Tsuji (a-tsuji@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.

Signed-off-by: Atsushi Tsuji <a-tsuji@bk.jp.nec.com>
---
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);

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ltt-dev] [PATCH] Add tracepoints to track pagecache transition
  2009-02-04  2:56     ` Atsushi Tsuji
@ 2009-02-04 11:44       ` Mathieu Desnoyers
  0 siblings, 0 replies; 8+ messages in thread
From: Mathieu Desnoyers @ 2009-02-04 11:44 UTC (permalink / raw)
  To: Atsushi Tsuji; +Cc: Kazuto Miyoshi, ltt-dev, systemtap

* Atsushi Tsuji (a-tsuji@bk.jp.nec.com) wrote:
> Mathieu Desnoyers wrote:
> > * Mathieu Desnoyers (compudj@krystal.dyndns.org) wrote:
> >> * Atsushi Tsuji (a-tsuji@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 <a-tsuji@bk.jp.nec.com>
> ---
> 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@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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add tracepoints to track pagecache transition
  2009-02-03  7:50 [PATCH] Add tracepoints to track pagecache transition Atsushi Tsuji
  2009-02-03 16:42 ` [ltt-dev] " Mathieu Desnoyers
@ 2009-02-05  8:03 ` Frank Ch. Eigler
  2009-02-09  9:49   ` Atsushi Tsuji
  2009-02-11 16:31 ` Mathieu Desnoyers
  2 siblings, 1 reply; 8+ messages in thread
From: Frank Ch. Eigler @ 2009-02-05  8:03 UTC (permalink / raw)
  To: Atsushi Tsuji; +Cc: mathieu.desnoyers, ltt-dev, systemtap, Kazuto Miyoshi


Atsushi Tsuji <a-tsuji@bk.jp.nec.com> writes:

> I thought it would be useful to trace pagecache behavior for problem
> analysis (performance bottlenecks, behavior differences between stable
> time and trouble time).

Interesting!  I hope it inspires more thinking about more places and
ways for graphical data visualization to apply.

> 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.

To what extent does your script work if it uses kprobes-based
kernel.function() probes?  (It can use "!" type probe point
decorations to automatically adapt to the preferred presence of the
tracepoints/markers.)

> I attached an example which is visualization of pagecache status
> using SystemTap. [...]

Would you consider sharing this script?


- FChE

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add tracepoints to track pagecache transition
  2009-02-05  8:03 ` Frank Ch. Eigler
@ 2009-02-09  9:49   ` Atsushi Tsuji
  0 siblings, 0 replies; 8+ messages in thread
From: Atsushi Tsuji @ 2009-02-09  9:49 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: mathieu.desnoyers, ltt-dev, systemtap, Kazuto Miyoshi

Frank Ch. Eigler wrote:
> Atsushi Tsuji <a-tsuji@bk.jp.nec.com> writes:
> 
>> I thought it would be useful to trace pagecache behavior for problem
>> analysis (performance bottlenecks, behavior differences between stable
>> time and trouble time).
> 
> Interesting!  I hope it inspires more thinking about more places and
> ways for graphical data visualization to apply.
> 
>> 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.
> 
> To what extent does your script work if it uses kprobes-based
> kernel.function() probes?  (It can use "!" type probe point
> decorations to automatically adapt to the preferred presence of the
> tracepoints/markers.)

Hi Frank,

Thank you for your response.
Yes, my script works using probe points in tapset (kprobes-based probes).
I attached this script below.

Thanks,
-Atsushi

----
Usage:
  ./pagecache_stat.stp

Output:
  This script outputs pagecache size(file-by-file basis) every 5 seconds like below.
 
  timestamp dev:inode pagecache size (KB), dev:inode pagecache size (KB),...

  (example)
  Thu Feb  5 05:21:29 2009 800003:4482806 112348
  Thu Feb  5 05:21:34 2009 800003:4482806 211968, 800003:4482817 96708,
  Thu Feb  5 05:21:39 2009 800003:4482806 294488, 800003:4482817 178604,
  Thu Feb  5 05:21:44 2009 800003:4482806 400560, 800003:4482817 288832,
                                .
                                .
                                .

#!/usr/bin/env stap

global cache

probe timer.ms(5000)
{
	printf("%s ",ctime(gettimeofday_s()));
	foreach([dev, ino] in cache){
		printf("%x:%d %d, ",dev ,ino , cache[dev, ino] * 4); /* page size is 4KB */
	}
	printf("\n");
}

probe vfs.add_to_page_cache.return
{
	/* $return == 0 if the page is really added to pagecache */
	if($return == 0){
		ino = $mapping->host->i_ino;
		dev = $mapping->host->i_sb->s_dev;
		cache[dev, ino]++;
	}
}

probe vfs.remove_from_page_cache
{
	cache[dev, ino]--;
}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Add tracepoints to track pagecache transition
  2009-02-03  7:50 [PATCH] Add tracepoints to track pagecache transition Atsushi Tsuji
  2009-02-03 16:42 ` [ltt-dev] " Mathieu Desnoyers
  2009-02-05  8:03 ` Frank Ch. Eigler
@ 2009-02-11 16:31 ` Mathieu Desnoyers
  2 siblings, 0 replies; 8+ messages in thread
From: Mathieu Desnoyers @ 2009-02-11 16:31 UTC (permalink / raw)
  To: Atsushi Tsuji; +Cc: ltt-dev, systemtap, Kazuto Miyoshi

* Atsushi Tsuji (a-tsuji@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.
>
> Signed-off-by: Atsushi Tsuji <a-tsuji@bk.jp.nec.com>

Hi Atsushi,

This patch looks good, thanks ! I'll merge it.

Please fix the settings of you mail client for the next patches, because
it seems to have problems with line-wrap. Lines longer than 80 columns
are wrapped, which makes patch application a bit more difficult.

Thanks,

Mathieu

> ---
> 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);
>
>



-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-02-11  7:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-03  7:50 [PATCH] Add tracepoints to track pagecache transition Atsushi Tsuji
2009-02-03 16:42 ` [ltt-dev] " Mathieu Desnoyers
2009-02-03 19:03   ` Mathieu Desnoyers
2009-02-04  2:56     ` Atsushi Tsuji
2009-02-04 11:44       ` Mathieu Desnoyers
2009-02-05  8:03 ` Frank Ch. Eigler
2009-02-09  9:49   ` Atsushi Tsuji
2009-02-11 16:31 ` Mathieu Desnoyers

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 read-only IMAP folder(s) and NNTP newsgroup(s).