smaps_(pte|pmd)() are almost the same, so let's clean them up to a single
function.

Signed-off-by: Naoya Horiguchi <[email protected]>
---
 fs/proc/task_mmu.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git mmotm-2014-05-21-16-57.orig/fs/proc/task_mmu.c 
mmotm-2014-05-21-16-57/fs/proc/task_mmu.c
index a750d0842875..1f2eab58ae14 100644
--- mmotm-2014-05-21-16-57.orig/fs/proc/task_mmu.c
+++ mmotm-2014-05-21-16-57/fs/proc/task_mmu.c
@@ -437,7 +437,7 @@ struct mem_size_stats {
        u64 pss;
 };
 
-static int smaps_pte(void *entry, unsigned long addr, unsigned long end,
+static int smaps_entry(void *entry, unsigned long addr, unsigned long end,
                        struct mm_walk *walk)
 {
        pte_t *pte = entry;
@@ -490,15 +490,10 @@ static int smaps_pte(void *entry, unsigned long addr, 
unsigned long end,
                        mss->private_clean += ptent_size;
                mss->pss += (ptent_size << PSS_SHIFT);
        }
-       return 0;
-}
 
-static int smaps_pmd(void *entry, unsigned long addr, unsigned long end,
-                       struct mm_walk *walk)
-{
-       struct mem_size_stats *mss = walk->private;
-       smaps_pte(entry, addr, end, walk);
-       mss->anonymous_thp += HPAGE_PMD_SIZE;
+       if (walk->size == PMD_SIZE)
+               mss->anonymous_thp += HPAGE_PMD_SIZE;
+
        return 0;
 }
 
@@ -563,8 +558,8 @@ static int show_smap(struct seq_file *m, void *v, int 
is_pid)
        struct vm_area_struct *vma = v;
        struct mem_size_stats mss;
        struct mm_walk smaps_walk = {
-               .pmd_entry = smaps_pmd,
-               .pte_entry = smaps_pte,
+               .pmd_entry = smaps_entry,
+               .pte_entry = smaps_entry,
                .mm = vma->vm_mm,
                .vma = vma,
                .private = &mss,
-- 
1.9.3

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

Reply via email to