Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966513AbaFTUMP (ORCPT ); Fri, 20 Jun 2014 16:12:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23243 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753892AbaFTUML (ORCPT ); Fri, 20 Jun 2014 16:12:11 -0400 From: Naoya Horiguchi To: linux-mm@kvack.org Cc: Andrew Morton , Dave Hansen , Hugh Dickins , "Kirill A. Shutemov" , linux-kernel@vger.kernel.org, Naoya Horiguchi Subject: [PATCH v3 03/13] pagewalk: add walk_page_vma() Date: Fri, 20 Jun 2014 16:11:29 -0400 Message-Id: <1403295099-6407-4-git-send-email-n-horiguchi@ah.jp.nec.com> In-Reply-To: <1403295099-6407-1-git-send-email-n-horiguchi@ah.jp.nec.com> References: <1403295099-6407-1-git-send-email-n-horiguchi@ah.jp.nec.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: 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: - check walk_page_test's return value instead of walk->skip Signed-off-by: Naoya Horiguchi --- include/linux/mm.h | 1 + mm/pagewalk.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git v3.16-rc1.orig/include/linux/mm.h v3.16-rc1/include/linux/mm.h index 489a63a06a4a..7e9287750866 100644 --- v3.16-rc1.orig/include/linux/mm.h +++ v3.16-rc1/include/linux/mm.h @@ -1137,6 +1137,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 v3.16-rc1.orig/mm/pagewalk.c v3.16-rc1/mm/pagewalk.c index 86d811202374..16865e5029f6 100644 --- v3.16-rc1.orig/mm/pagewalk.c +++ v3.16-rc1/mm/pagewalk.c @@ -271,3 +271,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 (err > 0) + return 0; + if (err < 0) + return err; + return __walk_page_range(vma->vm_start, vma->vm_end, walk); +} -- 1.9.3 -- 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/