--- v5
+++ v7
@@ -14,36 +14,32 @@
end of each routine, to increment *nr.
Reviewed-by: Jérôme Glisse <jglisse@redhat.com>
-Cc: Jan Kara <jack@suse.cz>
+Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
- mm/gup.c | 95 ++++++++++++++++++++++++--------------------------------
- 1 file changed, 40 insertions(+), 55 deletions(-)
+ mm/gup.c | 91 ++++++++++++++++++++++----------------------------------
+ 1 file changed, 36 insertions(+), 55 deletions(-)
diff --git a/mm/gup.c b/mm/gup.c
-index 85caf76b3012..858541ea30ce 100644
+index 85caf76b3012..f3c7d6625817 100644
--- a/mm/gup.c
+++ b/mm/gup.c
-@@ -1969,6 +1969,29 @@ static int __gup_device_huge_pud(pud_t pud, pud_t *pudp, unsigned long addr,
+@@ -1969,6 +1969,25 @@ static int __gup_device_huge_pud(pud_t pud, pud_t *pudp, unsigned long addr,
}
#endif
+static int __record_subpages(struct page *page, unsigned long addr,
+ unsigned long end, struct page **pages)
+{
-+ int nr = 0;
-+ int nr_recorded_pages = 0;
++ int nr;
+
-+ do {
-+ pages[nr] = page;
-+ nr++;
-+ page++;
-+ nr_recorded_pages++;
-+ } while (addr += PAGE_SIZE, addr != end);
-+ return nr_recorded_pages;
++ for (nr = 0; addr != end; addr += PAGE_SIZE)
++ pages[nr++] = page++;
++
++ return nr;
+}
+
+static void put_compound_head(struct page *page, int refs)
@@ -57,7 +53,7 @@
#ifdef CONFIG_ARCH_HAS_HUGEPD
static unsigned long hugepte_addr_end(unsigned long addr, unsigned long end,
unsigned long sz)
-@@ -1998,32 +2021,20 @@ static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
+@@ -1998,32 +2017,20 @@ static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
/* hugepages are never "special" */
VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
@@ -94,7 +90,7 @@
SetPageReferenced(head);
return 1;
}
-@@ -2071,28 +2082,19 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr,
+@@ -2071,28 +2078,19 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr,
pages, nr);
}
@@ -127,7 +123,7 @@
SetPageReferenced(head);
return 1;
}
-@@ -2114,28 +2116,19 @@ static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr,
+@@ -2114,28 +2112,19 @@ static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr,
pages, nr);
}
@@ -160,7 +156,7 @@
SetPageReferenced(head);
return 1;
}
-@@ -2151,28 +2144,20 @@ static int gup_huge_pgd(pgd_t orig, pgd_t *pgdp, unsigned long addr,
+@@ -2151,28 +2140,20 @@ static int gup_huge_pgd(pgd_t orig, pgd_t *pgdp, unsigned long addr,
return 0;
BUILD_BUG_ON(pgd_devmap(orig));