Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755381AbaFZNfw (ORCPT ); Thu, 26 Jun 2014 09:35:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38721 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751765AbaFZNfu (ORCPT ); Thu, 26 Jun 2014 09:35:50 -0400 Message-ID: <53AC21A8.5090703@redhat.com> Date: Thu, 26 Jun 2014 15:35:36 +0200 From: Jerome Marchand User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Naoya Horiguchi , linux-mm@kvack.org CC: Andrew Morton , Dave Hansen , Hugh Dickins , "Kirill A. Shutemov" , linux-kernel@vger.kernel.org, Naoya Horiguchi Subject: Re: [PATCH v3 04/13] smaps: remove mem_size_stats->vma and use walk_page_vma() References: <1403295099-6407-1-git-send-email-n-horiguchi@ah.jp.nec.com> <1403295099-6407-5-git-send-email-n-horiguchi@ah.jp.nec.com> In-Reply-To: <1403295099-6407-5-git-send-email-n-horiguchi@ah.jp.nec.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/20/2014 10:11 PM, Naoya Horiguchi wrote: > 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 > --- > fs/proc/task_mmu.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git v3.16-rc1.orig/fs/proc/task_mmu.c v3.16-rc1/fs/proc/task_mmu.c > index cfa63ee92c96..9b6c7d4fd3f4 100644 > --- v3.16-rc1.orig/fs/proc/task_mmu.c > +++ v3.16-rc1/fs/proc/task_mmu.c > @@ -430,7 +430,6 @@ const struct file_operations proc_tid_maps_operations = { > > #ifdef CONFIG_PROC_PAGE_MONITOR > struct mem_size_stats { > - struct vm_area_struct *vma; > unsigned long resident; > unsigned long shared_clean; > unsigned long shared_dirty; > @@ -449,7 +448,7 @@ static void smaps_pte_entry(pte_t ptent, unsigned long addr, > unsigned long ptent_size, struct mm_walk *walk) > { > struct mem_size_stats *mss = walk->private; > - struct vm_area_struct *vma = mss->vma; > + struct vm_area_struct *vma = walk->vma; > pgoff_t pgoff = linear_page_index(vma, addr); > struct page *page = NULL; > int mapcount; > @@ -501,7 +500,7 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, > struct mm_walk *walk) > { > struct mem_size_stats *mss = walk->private; > - struct vm_area_struct *vma = mss->vma; > + struct vm_area_struct *vma = walk->vma; > pte_t *pte; > spinlock_t *ptl; > > @@ -590,14 +589,13 @@ static int show_smap(struct seq_file *m, void *v, int is_pid) > struct mm_walk smaps_walk = { > .pmd_entry = smaps_pte_range, > .mm = vma->vm_mm, > + .vma = vma, Seems redundant: walk_page_vma() sets walk.vma anyway and so does walk_page_range(). Is there any case when the caller should set .vma itself? Jerome > .private = &mss, > }; > > memset(&mss, 0, sizeof mss); > - mss.vma = vma; > /* mmap_sem is held in m_start */ > - if (vma->vm_mm && !is_vm_hugetlb_page(vma)) > - walk_page_range(vma->vm_start, vma->vm_end, &smaps_walk); > + walk_page_vma(vma, &smaps_walk); > > show_map_vma(m, vma, is_pid); > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/