VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
author: Li Zhijian <lizhijian@cn.fujitsu.com> 2021-09-08 18:10:02 -0700 committer: Linus Torvalds <torvalds@linux-foundation.org> 2021-09-08 18:45:52 -0700 commit: 4b42fb213678d2b6a9eeea92a9be200f23e49583 parent: 2d338201d5311bcd79d42f66df4cecbcbc5f4f2c
Commit Summary:
mm/hmm: bypass devmap pte when all pfn requested flags are fulfilled
Diffstat:
1 file changed, 4 insertions, 1 deletion
diff --git a/mm/hmm.c b/mm/hmm.c
index fad6be2bf072..842e26599238 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -295,10 +295,13 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr,
 		goto fault;
 
 	/*
+	 * Bypass devmap pte such as DAX page when all pfn requested
+	 * flags(pfn_req_flags) are fulfilled.
 	 * Since each architecture defines a struct page for the zero page, just
 	 * fall through and treat it like a normal page.
 	 */
-	if (pte_special(pte) && !is_zero_pfn(pte_pfn(pte))) {
+	if (pte_special(pte) && !pte_devmap(pte) &&
+	    !is_zero_pfn(pte_pfn(pte))) {
 		if (hmm_pte_need_fault(hmm_vma_walk, pfn_req_flags, 0)) {
 			pte_unmap(ptep);
 			return -EFAULT;