On 2024/6/13 上午8:32, jiaqingtong97@xxxxxxxxx wrote:
From: Jia Qingtong <jiaqingtong97@xxxxxxxxx>
It seems redundant to check if pte is yong before the call to
kvm_pte_mkyoung in kvm_map_page_fast.
Just remove the check.
Signed-off-by: Jia Qingtong <jiaqingtong97@xxxxxxxxx>
---
arch/loongarch/kvm/mmu.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/loongarch/kvm/mmu.c b/arch/loongarch/kvm/mmu.c
index 98883aa23ab8..a46befcf85dc 100644
--- a/arch/loongarch/kvm/mmu.c
+++ b/arch/loongarch/kvm/mmu.c
@@ -551,10 +551,8 @@ static int kvm_map_page_fast(struct kvm_vcpu *vcpu, unsigned long gpa, bool writ
}
/* Track access to pages marked old */
- new = *ptep;
- if (!kvm_pte_young(new))
- new = kvm_pte_mkyoung(new);
- /* call kvm_set_pfn_accessed() after unlock */
+ new = kvm_pte_mkyoung(*ptep);
+ /* call kvm_set_pfn_accessed() after unlock */
Sorry, please ignore my previous comments.
It is to modify local variable, rather than update pte entry.
Reviewed-by: Bibo Mao <maobibo@xxxxxxxxxxx>
if (write && !kvm_pte_dirty(new)) {
if (!kvm_pte_write(new)) {
base-commit: eb36e520f4f1b690fd776f15cbac452f82ff7bfa