• Peter Xu's avatar
    mm: Introduce mm_struct.has_pinned · 008cfe44
    Peter Xu authored
    (Commit message majorly collected from Jason Gunthorpe)
    
    Reduce the chance of false positive from page_maybe_dma_pinned() by
    keeping track if the mm_struct has ever been used with pin_user_pages().
    This allows cases that might drive up the page ref_count to avoid any
    penalty from handling dma_pinned pages.
    
    Future work is planned, to provide a more sophisticated solution, likely
    to turn it into a real counter.  For now, make it atomic_t but use it as
    a boolean for simplicity.
    Suggested-by: default avatarJason Gunthorpe <jgg@ziepe.ca>
    Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    008cfe44
gup.c 84.1 KB