]> git.baikalelectronics.ru Git - kernel.git/commit
mm: Introduce mm_struct.has_pinned
authorPeter Xu <peterx@redhat.com>
Fri, 25 Sep 2020 22:25:57 +0000 (18:25 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 27 Sep 2020 18:21:35 +0000 (11:21 -0700)
commitab185de10f6eaa1bdcf62132d7130424c613637e
treefecd1175184b14d889738d6491a1cccf0b0a8ae5
parent7762da803a2764c7d3db6ea00bcc3a0ad8f1b4d4
mm: Introduce mm_struct.has_pinned

(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: Jason Gunthorpe <jgg@ziepe.ca>
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/mm_types.h
kernel/fork.c
mm/gup.c