Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 3767

kernel-2.6.18-194.11.1.el5.src.rpm

From: KII Keiichi <kkii@redhat.com>
Date: Thu, 23 Apr 2009 15:42:38 -0400
Subject: [trace] tracepoints for page cache
Message-id: 49F0C4AE.7010006@redhat.com
O-Subject: Re: [RHEL5.4 PATCH 2/2] BZ475719: tracepoints for page cache
Bugzilla: 475719
RH-Acked-by: Larry Woodman <lwoodman@redhat.com>

 >> This is the second patch to add tracepoints for page cache.
 >> The purpose is to get file-by-file page cache usage.
 >
 > I would be happy to help you try get these tracepoints
 > upstream.  They could be very useful for debugging
 > various performance problems.

diff --git a/include/trace/filemap.h b/include/trace/filemap.h
new file mode 100644
index 0000000..6fc18cd
--- /dev/null
+++ b/include/trace/filemap.h
@@ -0,0 +1,14 @@
+#ifndef _TRACE_FILEMAP_H
+#define _TRACE_FILEMAP_H
+
+#include <linux/tracepoint.h>
+#include <linux/fs.h>
+
+DEFINE_TRACE(add_to_page_cache,
+	TPPROTO(struct address_space *mapping, pgoff_t offset),
+	TPARGS(mapping, offset));
+DEFINE_TRACE(remove_from_page_cache,
+	TPPROTO(struct address_space *mapping, pgoff_t offset),
+	TPARGS(mapping, offset));
+
+#endif
diff --git a/mm/filemap.c b/mm/filemap.c
index ecb40af..6aa48e1 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -32,6 +32,7 @@
 #include <linux/cpuset.h>
 #include <linux/hardirq.h> /* for BUG_ON(!in_atomic()) only */
 #include "internal.h"
+#include <trace/filemap.h>
 
 /*
  * FIXME: remove all knowledge of the buffer layer from the core VM
@@ -119,6 +120,7 @@ void __remove_from_page_cache(struct page *page)
 	radix_tree_delete(&mapping->page_tree, page->index);
 	page->mapping = NULL;
 	mapping->nrpages--;
+	trace_remove_from_page_cache(mapping, page->index);
 	__dec_zone_page_state(page, NR_FILE_PAGES);
 }
 
@@ -449,6 +451,7 @@ int add_to_page_cache(struct page *page, struct address_space *mapping,
 			page->mapping = mapping;
 			page->index = offset;
 			mapping->nrpages++;
+			trace_add_to_page_cache(mapping, offset);
 			__inc_zone_page_state(page, NR_FILE_PAGES);
 		}
 		write_unlock_irq(&mapping->tree_lock);