[PATCH 4/5] Capture references to page cache pages

From: Ankita Garg
Date: Tue Jul 05 2011 - 04:23:44 EST


Hi,

Page cache accesses may not be mapped, hence fake an access when a
pagecache page is looked up, by marking the corresponding memory
address block as accessed.

Signed-off-by: Ankita Garg <ankita@xxxxxxxxxx>
---
mm/filemap.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index a8251a8..7ae7f36 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -36,6 +36,7 @@
#include <linux/mm_inline.h> /* for page_is_file_cache() */
#include <linux/cleancache.h>
#include "internal.h"
+#include <linux/memtrace.h>

/*
* FIXME: remove all knowledge of the buffer layer from the core VM
@@ -730,6 +731,13 @@ repeat:
page_cache_release(page);
goto repeat;
}
+#if defined(CONFIG_MEMTRACE)
+ if(get_pg_trace_pid() != -1 && current->mem_trace) {
+ unsigned long pfn = page_to_pfn(page);
+ if(pfn_valid(pfn))
+ mark_memtrace_block_accessed(pfn << PAGE_SHIFT);
+ }
+#endif
}
out:
rcu_read_unlock();
--
1.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/