From: Rusty Russell Putting the vma inside "struct mem_size_stats" to hand it through the pagewalker is a little gross. Making a separate struct is more verbose, but clearer. Signed-off-by: Rusty Russell Cc: Matt Mackall Signed-off-by: Andrew Morton --- fs/proc/task_mmu.c | 32 +++++++++++++++++++------------- 1 files changed, 19 insertions(+), 13 deletions(-) diff -puN fs/proc/task_mmu.c~mmaps2-vma-out-of-mem_size_stats fs/proc/task_mmu.c --- a/fs/proc/task_mmu.c~mmaps2-vma-out-of-mem_size_stats +++ a/fs/proc/task_mmu.c @@ -318,7 +318,6 @@ const struct file_operations proc_maps_o #ifdef CONFIG_PROC_SMAPS struct mem_size_stats { - struct vm_area_struct *vma; unsigned long resident; unsigned long shared_clean; unsigned long shared_dirty; @@ -327,11 +326,18 @@ struct mem_size_stats unsigned long referenced; }; +struct smaps_arg +{ + struct mem_size_stats mss; + struct vm_area_struct *vma; +}; + static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, void *private) { - struct mem_size_stats *mss = private; - struct vm_area_struct *vma = mss->vma; + struct smaps_arg *sarg = private; + struct vm_area_struct *vma = sarg->vma; + struct mem_size_stats *mss = &sarg->mss; pte_t *pte, ptent; spinlock_t *ptl; struct page *page; @@ -373,14 +379,14 @@ static struct mm_walk smaps_walk = { .pm static int show_smap(struct seq_file *m, void *v) { struct vm_area_struct *vma = v; - struct mem_size_stats mss; + struct smaps_arg sarg; int ret; - memset(&mss, 0, sizeof mss); - mss.vma = vma; + memset(&sarg.mss, 0, sizeof sarg.mss); + sarg.vma = vma; if (vma->vm_mm && !is_vm_hugetlb_page(vma)) walk_page_range(vma->vm_mm, vma->vm_start, vma->vm_end, - &smaps_walk, &mss); + &smaps_walk, &sarg); ret = show_map(m, v); if (ret) @@ -395,12 +401,12 @@ static int show_smap(struct seq_file *m, "Private_Dirty: %8lu kB\n" "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.referenced >> 10); + sarg.mss.resident >> 10, + sarg.mss.shared_clean >> 10, + sarg.mss.shared_dirty >> 10, + sarg.mss.private_clean >> 10, + sarg.mss.private_dirty >> 10, + sarg.mss.referenced >> 10); return ret; } _