Skip to content

Commit 14eb6fd

Browse files
Naoya Horiguchitorvalds
authored andcommitted
smaps: remove mem_size_stats->vma and use walk_page_vma()
pagewalk.c can handle vma in itself, so we don't have to pass vma via walk->private. And show_smap() walks pages on vma basis, so using walk_page_vma() is preferable. Signed-off-by: Naoya Horiguchi <[email protected]> Acked-by: Kirill A. Shutemov <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Cyrill Gorcunov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Pavel Emelyanov <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 900fc5f commit 14eb6fd

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

fs/proc/task_mmu.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,6 @@ const struct file_operations proc_tid_maps_operations = {
436436

437437
#ifdef CONFIG_PROC_PAGE_MONITOR
438438
struct mem_size_stats {
439-
struct vm_area_struct *vma;
440439
unsigned long resident;
441440
unsigned long shared_clean;
442441
unsigned long shared_dirty;
@@ -485,7 +484,7 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr,
485484
struct mm_walk *walk)
486485
{
487486
struct mem_size_stats *mss = walk->private;
488-
struct vm_area_struct *vma = mss->vma;
487+
struct vm_area_struct *vma = walk->vma;
489488
struct page *page = NULL;
490489

491490
if (pte_present(*pte)) {
@@ -509,7 +508,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
509508
struct mm_walk *walk)
510509
{
511510
struct mem_size_stats *mss = walk->private;
512-
struct vm_area_struct *vma = mss->vma;
511+
struct vm_area_struct *vma = walk->vma;
513512
struct page *page;
514513

515514
/* FOLL_DUMP will return -EFAULT on huge zero page */
@@ -530,8 +529,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
530529
static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
531530
struct mm_walk *walk)
532531
{
533-
struct mem_size_stats *mss = walk->private;
534-
struct vm_area_struct *vma = mss->vma;
532+
struct vm_area_struct *vma = walk->vma;
535533
pte_t *pte;
536534
spinlock_t *ptl;
537535

@@ -623,10 +621,8 @@ static int show_smap(struct seq_file *m, void *v, int is_pid)
623621
};
624622

625623
memset(&mss, 0, sizeof mss);
626-
mss.vma = vma;
627624
/* mmap_sem is held in m_start */
628-
if (vma->vm_mm && !is_vm_hugetlb_page(vma))
629-
walk_page_range(vma->vm_start, vma->vm_end, &smaps_walk);
625+
walk_page_vma(vma, &smaps_walk);
630626

631627
show_map_vma(m, vma, is_pid);
632628

0 commit comments

Comments
 (0)