mm/hmm/mirror: device page fault handler
Subsystems (2)
[email protected]
maintainerPATCH 15/126 mm/hmm/mirror: device page fault handler
From: Jérôme Glisse <[email protected]>
Subject: mm/hmm/mirror: device page fault handler
This handles page fault on behalf of device driver, unlike handle_mm_fault() it does not trigger migration back to system memory for device memory.
Signed-off-by Jérôme Glisse <[email protected]>
Signed-off-by Evgeny Baskakov <[email protected]>
Signed-off-by John Hubbard <[email protected]>
Signed-off-by Mark Hairgrove <[email protected]>
Signed-off-by Sherry Cheung <[email protected]>
Signed-off-by Subhash Gutti <[email protected]>
Cc Aneesh Kumar <[email protected]>
Cc Balbir Singh <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Dan Williams <[email protected]>
Cc David Nellans <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Kirill A. Shutemov <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Paul E. McKenney <[email protected]>
Cc Ross Zwisler <[email protected]>
Cc Vladimir Davydov <[email protected]>
Cc Bob Liu <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
include/linux/hmm.h | 27 ++++ mm/hmm.c | 256 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 271 insertions(+), 12 deletions(-)
include/linux/hmm.h renamed from include/linux/hmm.h~mm-hmm-mirror-device-page-fault-handler +27 -0
@@ -292,6 +292,33 @@ int hmm_vma_get_pfns(struct vm_area_struunsigned long end, hmm_pfn_t *pfns);bool hmm_vma_range_done (struct vm_area_struct *vma,struct hmm_range *range); + + +/* +* Fault memory on behalf of device driver. Unlike handle_mm_fault(), this will +* not migrate any device memory back to system memory. The hmm_pfn_t array will +* be updated with the fault result and current snapshot of the CPU page table +* for the range. +* +* The mmap_sem must be taken in read mode before entering and it might be +* dropped by the function if the block argument is false. In that case, the +* function returns -EAGAIN. +* +* Return value does not reflect if the fault was successful for every single +* address or not. Therefore, the caller must to inspect the hmm_pfn_t array to +* determine fault status for each address. +* +* Trying to fault inside an invalid vma will result in -EINVAL. +* +* See the function description in mm/hmm.c for further documentation. +*/ +int hmm_vma_fault (struct vm_area_struct *vma, +struct hmm_range *range, +unsigned long start, +unsigned long end, +hmm_pfn_t *pfns, +bool write, +bool block);#endif /* IS_ENABLED(CONFIG_HMM_MIRROR) */
mm/hmm.c renamed from mm/hmm.c~mm-hmm-mirror-device-page-fault-handler +244 -12
358 lines not on this page · raw message
_