[PATCH] x86/mm: fix return value of p[um]dp_set_access_flags

From: Wei Yang
Date: Thu Sep 19 2019 - 04:26:13 EST


Function p[um]dp_set_access_flags is used with update_mmu_cache_p[um]d
and the return value from p[um]dp_set_access_flags indicates whether it
is necessary to do the cache update.

>From current code logic, only when changed && dirty, related page table
entry would be updated. It is not necessary to update cache when the
real page table entry is not changed.

Signed-off-by: Wei Yang <richardw.yang@xxxxxxxxxxxxxxx>
---
arch/x86/mm/pgtable.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index 44816ff6411f..ba910f8ab43a 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -509,9 +509,10 @@ int pmdp_set_access_flags(struct vm_area_struct *vma,
* #PF is architecturally guaranteed to do that and in the
* worst-case we'll generate a spurious fault.
*/
+ return true;
}

- return changed;
+ return false;
}

int pudp_set_access_flags(struct vm_area_struct *vma, unsigned long address,
@@ -529,9 +530,10 @@ int pudp_set_access_flags(struct vm_area_struct *vma, unsigned long address,
* #PF is architecturally guaranteed to do that and in the
* worst-case we'll generate a spurious fault.
*/
+ return true;
}

- return changed;
+ return false;
}
#endif

--
2.17.1