mincore: do nested page table walks

Previous thread: mincore: pass ranges as start,end address pairs by Linux Kernel Mailing List on Tuesday, May 25, 2010 - 8:59 am. (1 message)

Next thread: pagemap: add #ifdefs CONFIG_HUGETLB_PAGE on code walking hugetlb vma by Linux Kernel Mailing List on Tuesday, May 25, 2010 - 8:59 am. (1 message)
From: Linux Kernel Mailing List
Date: Tuesday, May 25, 2010 - 8:59 am

Gitweb:     http://git.kernel.org/linus/e48293fd75b3aa67f43ad6e3d2ff397caa55d58b
Commit:     e48293fd75b3aa67f43ad6e3d2ff397caa55d58b
Parent:     25ef0e50cca790370ad7838e3ad74db6a6a2d829
Author:     Johannes Weiner <hannes@cmpxchg.org>
AuthorDate: Mon May 24 14:32:11 2010 -0700
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Tue May 25 08:06:58 2010 -0700

    mincore: do nested page table walks
    
    Do page table walks with the well-known nested loops we use in several
    other places already.
    
    This avoids doing full page table walks after every pte range and also
    allows to handle unmapped areas bigger than one pte range in one go.
    
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 mm/mincore.c |   75 ++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 58 insertions(+), 17 deletions(-)

diff --git a/mm/mincore.c b/mm/mincore.c
index 211604a..9ac42dc 100644
--- a/mm/mincore.c
+++ b/mm/mincore.c
@@ -144,6 +144,60 @@ static void mincore_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
 	pte_unmap_unlock(ptep - 1, ptl);
 }
 
+static void mincore_pmd_range(struct vm_area_struct *vma, pud_t *pud,
+			unsigned long addr, unsigned long end,
+			unsigned char *vec)
+{
+	unsigned long next;
+	pmd_t *pmd;
+
+	pmd = pmd_offset(pud, addr);
+	do {
+		next = pmd_addr_end(addr, end);
+		if (pmd_none_or_clear_bad(pmd))
+			mincore_unmapped_range(vma, addr, next, vec);
+		else
+			mincore_pte_range(vma, pmd, addr, next, vec);
+		vec += (next - addr) >> PAGE_SHIFT;
+	} while (pmd++, addr = next, addr != end);
+}
+
+static void mincore_pud_range(struct vm_area_struct *vma, pgd_t *pgd,
+			unsigned long addr, unsigned long end,
+			unsigned char *vec)
+{
+	unsigned long ...
Previous thread: mincore: pass ranges as start,end address pairs by Linux Kernel Mailing List on Tuesday, May 25, 2010 - 8:59 am. (1 message)

Next thread: pagemap: add #ifdefs CONFIG_HUGETLB_PAGE on code walking hugetlb vma by Linux Kernel Mailing List on Tuesday, May 25, 2010 - 8:59 am. (1 message)