summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/hmm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/mm/hmm.c b/mm/hmm.c
index 53192c32abc9..660e8db44811 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -250,11 +250,11 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr,
pte_t pte = *ptep;
uint64_t orig_pfn = *pfn;
- *pfn = range->values[HMM_PFN_NONE];
if (pte_none(pte)) {
required_fault = hmm_pte_need_fault(hmm_vma_walk, orig_pfn, 0);
if (required_fault)
goto fault;
+ *pfn = range->values[HMM_PFN_NONE];
return 0;
}
@@ -275,8 +275,10 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr,
}
required_fault = hmm_pte_need_fault(hmm_vma_walk, orig_pfn, 0);
- if (!required_fault)
+ if (!required_fault) {
+ *pfn = range->values[HMM_PFN_NONE];
return 0;
+ }
if (!non_swap_entry(entry))
goto fault;
@@ -494,7 +496,6 @@ static int hmm_vma_walk_hugetlb_entry(pte_t *pte, unsigned long hmask,
i = (start - range->start) >> PAGE_SHIFT;
orig_pfn = range->pfns[i];
- range->pfns[i] = range->values[HMM_PFN_NONE];
cpu_flags = pte_to_hmm_pfn_flags(range, entry);
required_fault = hmm_pte_need_fault(hmm_vma_walk, orig_pfn, cpu_flags);
if (required_fault) {