• Peter Xu's avatar
    mm/gup: drop gup_fast_folio_allowed() in hugepd processing · 607c6319
    Peter Xu authored
    Hugepd format for GUP is only used in PowerPC with hugetlbfs.  There are
    some kernel usage of hugepd (can refer to hugepd_populate_kernel() for
    PPC_8XX), however those pages are not candidates for GUP.
    
    Commit a6e79df9 ("mm/gup: disallow FOLL_LONGTERM GUP-fast writing to
    file-backed mappings") added a check to fail gup-fast if there's potential
    risk of violating GUP over writeback file systems.  That should never
    apply to hugepd.  Considering that hugepd is an old format (and even
    software-only), there's no plan to extend hugepd into other file typed
    memories that is prone to the same issue.
    
    Drop that check, not only because it'll never be true for hugepd per any
    known plan, but also it paves way for reusing the function outside
    fast-gup.
    
    To make sure we'll still remember this issue just in case hugepd will be
    extended to support non-hugetlbfs memories, add a rich comment above
    gup_huge_pd(), explaining the issue with proper references.
    
    [akpm@linux-foundation.org: fix comment, per David]
    Link: https://lkml.kernel.org/r/20240327152332.950956-7-peterx@redhat.comSigned-off-by: default avatarPeter Xu <peterx@redhat.com>
    Tested-by: default avatarRyan Roberts <ryan.roberts@arm.com>
    Cc: Christoph Hellwig <hch@infradead.org>
    Cc: Lorenzo Stoakes <lstoakes@gmail.com>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Andrew Jones <andrew.jones@linux.dev>
    Cc: Aneesh Kumar K.V (IBM) <aneesh.kumar@kernel.org>
    Cc: Axel Rasmussen <axelrasmussen@google.com>
    Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: James Houghton <jthoughton@google.com>
    Cc: Jason Gunthorpe <jgg@nvidia.com>
    Cc: John Hubbard <jhubbard@nvidia.com>
    Cc: Kirill A. Shutemov <kirill@shutemov.name>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: "Mike Rapoport (IBM)" <rppt@kernel.org>
    Cc: Muchun Song <muchun.song@linux.dev>
    Cc: Rik van Riel <riel@surriel.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Yang Shi <shy828301@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    607c6319
gup.c 97.3 KB