Skip to content

Commit 4b42fb2

Browse files
zhijianli88torvalds
authored andcommitted
mm/hmm: bypass devmap pte when all pfn requested flags are fulfilled
Previously, we noticed the one rpma example was failed[1] since commit 36f30e4 ("IB/core: Improve ODP to use hmm_range_fault()"), where it will use ODP feature to do RDMA WRITE between fsdax files. After digging into the code, we found hmm_vma_handle_pte() will still return EFAULT even though all the its requesting flags has been fulfilled. That's because a DAX page will be marked as (_PAGE_SPECIAL | PAGE_DEVMAP) by pte_mkdevmap(). Link: pmem/rpma#1142 [1] Link: https://lkml.kernel.org/r/[email protected] Fixes: 4055062 ("mm/hmm: add missing call to hmm_pte_need_fault in HMM_PFN_SPECIAL handling") Signed-off-by: Li Zhijian <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 2d33820 commit 4b42fb2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mm/hmm.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,13 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr,
295295
goto fault;
296296

297297
/*
298+
* Bypass devmap pte such as DAX page when all pfn requested
299+
* flags(pfn_req_flags) are fulfilled.
298300
* Since each architecture defines a struct page for the zero page, just
299301
* fall through and treat it like a normal page.
300302
*/
301-
if (pte_special(pte) && !is_zero_pfn(pte_pfn(pte))) {
303+
if (pte_special(pte) && !pte_devmap(pte) &&
304+
!is_zero_pfn(pte_pfn(pte))) {
302305
if (hmm_pte_need_fault(hmm_vma_walk, pfn_req_flags, 0)) {
303306
pte_unmap(ptep);
304307
return -EFAULT;

0 commit comments

Comments
 (0)