Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f79f177c25016647cc92ffac8afa7cb96ce47011
Commit:     f79f177c25016647cc92ffac8afa7cb96ce47011
Parent:     826fad1b93fdb4ffacfd9cd860f06140e852e377
Author:     David Rientjes <[EMAIL PROTECTED]>
AuthorDate: Sun May 6 14:49:22 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon May 7 12:12:52 2007 -0700

    smaps: add pages referenced count to smaps
    
    Adds an additional unsigned long field to struct mem_size_stats called
    'referenced'.  For each pte walked in the smaps code, this field is
    incremented by PAGE_SIZE if it has pte-reference bits.
    
    An additional line was added to the /proc/pid/smaps output for each VMA to
    indicate how many pages within it are currently marked as referenced or
    accessed.
    
    Cc: Hugh Dickins <[EMAIL PROTECTED]>
    Cc: Paul Mundt <[EMAIL PROTECTED]>
    Cc: Christoph Lameter <[EMAIL PROTECTED]>
    Signed-off-by: David Rientjes <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/proc/task_mmu.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 9d22c1c..199088e 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -120,6 +120,7 @@ struct mem_size_stats
        unsigned long shared_dirty;
        unsigned long private_clean;
        unsigned long private_dirty;
+       unsigned long referenced;
 };
 
 struct pmd_walker {
@@ -188,18 +189,20 @@ static int show_map_internal(struct seq_file *m, void *v, 
struct mem_size_stats
 
        if (mss)
                seq_printf(m,
-                          "Size:          %8lu kB\n"
-                          "Rss:           %8lu kB\n"
-                          "Shared_Clean:  %8lu kB\n"
-                          "Shared_Dirty:  %8lu kB\n"
-                          "Private_Clean: %8lu kB\n"
-                          "Private_Dirty: %8lu kB\n",
+                          "Size:           %8lu kB\n"
+                          "Rss:            %8lu kB\n"
+                          "Shared_Clean:   %8lu kB\n"
+                          "Shared_Dirty:   %8lu kB\n"
+                          "Private_Clean:  %8lu kB\n"
+                          "Private_Dirty:  %8lu kB\n"
+                          "Pgs_Referenced: %8lu kB\n",
                           (vma->vm_end - vma->vm_start) >> 10,
                           mss->resident >> 10,
                           mss->shared_clean  >> 10,
                           mss->shared_dirty  >> 10,
                           mss->private_clean >> 10,
-                          mss->private_dirty >> 10);
+                          mss->private_dirty >> 10,
+                          mss->referenced >> 10);
 
        if (m->count < m->size)  /* vma is copied successfully */
                m->version = (vma != get_gate_vma(task))? vma->vm_start: 0;
@@ -232,6 +235,9 @@ static void smaps_one_pmd(struct vm_area_struct *vma, pmd_t 
*pmd,
                if (!page)
                        continue;
 
+               /* Accumulate the size in pages that have been accessed. */
+               if (pte_young(ptent) || PageReferenced(page))
+                       mss->referenced += PAGE_SIZE;
                if (page_mapcount(page) >= 2) {
                        if (pte_dirty(ptent))
                                mss->shared_dirty += PAGE_SIZE;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to