Skip to content

Commit ae3c99e

Browse files
xzpeterakpm00
authored andcommitted
mm/gup: detect huge pfnmap entries in gup-fast
Since gup-fast doesn't have the vma reference, teach it to detect such huge pfnmaps by checking the special bit for pmd/pud too, just like ptes. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Peter Xu <[email protected]> Acked-by: David Hildenbrand <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Alex Williamson <[email protected]> Cc: Aneesh Kumar K.V <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Gavin Shan <[email protected]> Cc: Gerald Schaefer <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Niklas Schnelle <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Will Deacon <[email protected]> Cc: Zi Yan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 5dd4072 commit ae3c99e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

mm/gup.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3038,6 +3038,9 @@ static int gup_fast_pmd_leaf(pmd_t orig, pmd_t *pmdp, unsigned long addr,
30383038
if (!pmd_access_permitted(orig, flags & FOLL_WRITE))
30393039
return 0;
30403040

3041+
if (pmd_special(orig))
3042+
return 0;
3043+
30413044
if (pmd_devmap(orig)) {
30423045
if (unlikely(flags & FOLL_LONGTERM))
30433046
return 0;
@@ -3082,6 +3085,9 @@ static int gup_fast_pud_leaf(pud_t orig, pud_t *pudp, unsigned long addr,
30823085
if (!pud_access_permitted(orig, flags & FOLL_WRITE))
30833086
return 0;
30843087

3088+
if (pud_special(orig))
3089+
return 0;
3090+
30853091
if (pud_devmap(orig)) {
30863092
if (unlikely(flags & FOLL_LONGTERM))
30873093
return 0;

0 commit comments

Comments
 (0)