Skip to content

Commit

Permalink
sparc64: Fix bugs in get_user_pages_fast() wrt. THP.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David S. Miller committed May 4, 2014
1 parent 51e5ef1 commit 04df419
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/sparc/include/asm/pgtable_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arch/sparc/mm/gup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 04df419

Please sign in to comment.