sparc64: Fix bugs in get_user_pages_fast() wrt. THP.
authorDavid S. Miller <davem@davemloft.net>
Fri, 25 Apr 2014 17:21:12 +0000 (10:21 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 4 May 2014 05:32:37 +0000 (22:32 -0700)
The large PMD path needs to check _PAGE_VALID not _PAGE_PRESENT, to
decide if it needs to bail and return 0.

pmd_large() should therefore just check _PAGE_PMD_HUGE.

Calls to gup_huge_pmd() are guarded with a check of pmd_large(), so we
just need to add a valid bit check.

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/include/asm/pgtable_64.h
arch/sparc/mm/gup.c

index e3db4b8e689b2e2f175ef3afdc8db069e6859764..1f281030769c70b15e2a030f015c90d8c9db5883 100644 (file)
@@ -633,7 +633,7 @@ static inline unsigned long pmd_large(pmd_t pmd)
 {
        pte_t pte = __pte(pmd_val(pmd));
 
-       return (pte_val(pte) & _PAGE_PMD_HUGE) && pte_present(pte);
+       return pte_val(pte) & _PAGE_PMD_HUGE;
 }
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
index c4d3da68b800db27e54761add314e4a882f4e4c6..1aed0432c64bab8344ad524ed28b835381588035 100644 (file)
@@ -73,7 +73,7 @@ static int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
        struct page *head, *page, *tail;
        int refs;
 
-       if (!pmd_large(pmd))
+       if (!(pmd_val(pmd) & _PAGE_VALID))
                return 0;
 
        if (write && !pmd_write(pmd))