From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by kanga.kvack.org (Postfix) with ESMTP id 192E46B0031 for ; Mon, 13 Jan 2014 11:54:31 -0500 (EST) Received: by mail-ee0-f54.google.com with SMTP id e51so2776051eek.13 for ; Mon, 13 Jan 2014 08:54:31 -0800 (PST) Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTP id l2si29686750een.251.2014.01.13.08.54.29 for ; Mon, 13 Jan 2014 08:54:30 -0800 (PST) From: Naoya Horiguchi Subject: [PATCH 02/11] pagewalk: add walk_page_vma() Date: Mon, 13 Jan 2014 11:54:02 -0500 Message-Id: <1389632051-25159-3-git-send-email-n-horiguchi@ah.jp.nec.com> In-Reply-To: <1389632051-25159-1-git-send-email-n-horiguchi@ah.jp.nec.com> References: <1389632051-25159-1-git-send-email-n-horiguchi@ah.jp.nec.com> Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org Cc: Andrew Morton , Matt Mackall , Cliff Wickman , KOSAKI Motohiro , Johannes Weiner , KAMEZAWA Hiroyuki , Michal Hocko , "Aneesh Kumar K.V" , Pavel Emelyanov , Rik van Riel , kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org Introduces walk_page_vma(), which is useful for the callers which want to walk over a given vma. It's used by later patches. ChangeLog v4: - rename skip_check to skip_lower_level_walking Signed-off-by: Naoya Horiguchi --- include/linux/mm.h | 1 + mm/pagewalk.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git mmotm-2014-01-09-16-23.orig/include/linux/mm.h mmotm-2014-01-09-16-23/include/linux/mm.h index 4760665f97c5..262e9d943533 100644 --- mmotm-2014-01-09-16-23.orig/include/linux/mm.h +++ mmotm-2014-01-09-16-23/include/linux/mm.h @@ -1021,6 +1021,7 @@ struct mm_walk { int walk_page_range(unsigned long addr, unsigned long end, struct mm_walk *walk); +int walk_page_vma(struct vm_area_struct *vma, struct mm_walk *walk); void free_pgd_range(struct mmu_gather *tlb, unsigned long addr, unsigned long end, unsigned long floor, unsigned long ceiling); int copy_page_range(struct mm_struct *dst, struct mm_struct *src, diff --git mmotm-2014-01-09-16-23.orig/mm/pagewalk.c mmotm-2014-01-09-16-23/mm/pagewalk.c index 6b9df0ead2bd..98a2385616a2 100644 --- mmotm-2014-01-09-16-23.orig/mm/pagewalk.c +++ mmotm-2014-01-09-16-23/mm/pagewalk.c @@ -333,3 +333,21 @@ int walk_page_range(unsigned long start, unsigned long end, } while (start = next, start < end); return err; } + +int walk_page_vma(struct vm_area_struct *vma, struct mm_walk *walk) +{ + int err; + + if (!walk->mm) + return -EINVAL; + + VM_BUG_ON(!rwsem_is_locked(&walk->mm->mmap_sem)); + VM_BUG_ON(!vma); + walk->vma = vma; + err = walk_page_test(vma->vm_start, vma->vm_end, walk); + if (skip_lower_level_walking(walk)) + return 0; + if (err) + return err; + return __walk_page_range(vma->vm_start, vma->vm_end, walk); +} -- 1.8.4.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org