[RFC][PATCH 2/3] track numbers of pagetable pages

From: Dave Hansen
Date: Fri Apr 15 2011 - 13:38:54 EST



Now that we have the mm in the constructor and destructor, it's
simple to to bump a counter. Add the counter to the mm and use
the existing MM_* counter infrastructure.

Signed-off-by: Dave Hansen <dave@xxxxxxxxxxxxxxxxxx>
---

linux-2.6.git-dave/include/linux/mm.h | 2 ++
linux-2.6.git-dave/include/linux/mm_types.h | 1 +
2 files changed, 3 insertions(+)

diff -puN include/linux/mm.h~track-pagetable-pages include/linux/mm.h
--- linux-2.6.git/include/linux/mm.h~track-pagetable-pages 2011-04-15 10:37:10.768832396 -0700
+++ linux-2.6.git-dave/include/linux/mm.h 2011-04-15 10:37:10.780832393 -0700
@@ -1245,12 +1245,14 @@ static inline pmd_t *pmd_alloc(struct mm
static inline void pgtable_page_ctor(struct mm_struct *mm, struct page *page)
{
pte_lock_init(page);
+ inc_mm_counter(mm, MM_PTEPAGES);
inc_zone_page_state(page, NR_PAGETABLE);
}

static inline void pgtable_page_dtor(struct mm_struct *mm, struct page *page)
{
pte_lock_deinit(page);
+ dec_mm_counter(mm, MM_PTEPAGES);
dec_zone_page_state(page, NR_PAGETABLE);
}

diff -puN include/linux/mm_types.h~track-pagetable-pages include/linux/mm_types.h
--- linux-2.6.git/include/linux/mm_types.h~track-pagetable-pages 2011-04-15 10:37:10.772832395 -0700
+++ linux-2.6.git-dave/include/linux/mm_types.h 2011-04-15 10:37:10.780832393 -0700
@@ -200,6 +200,7 @@ enum {
MM_FILEPAGES,
MM_ANONPAGES,
MM_SWAPENTS,
+ MM_PTEPAGES,
NR_MM_COUNTERS
};

_
--
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/