aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2008-04-03 05:02:21 -0400
committerAvi Kivity <avi@qumranet.com>2008-04-27 05:00:57 -0400
commitfcd6dbac9267c1c06a205ad8bb4bd027c0ace7f7 (patch)
treea9645557d1d20d344f21ab464137a64896598d58 /arch/x86/kvm/mmu.c
parentd39f13b0da7fa7f705fbe6c80995205d0380bc7a (diff)
KVM: MMU: Only mark_page_accessed() if the page was accessed by the guest
If the accessed bit is not set, the guest has never accessed this page (at least through this spte), so there's no need to mark the page accessed. This provides more accurate data for the eviction algortithm. Noted by Andrea Arcangeli. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 1594ee06c920..5c4c16662c68 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -549,7 +549,8 @@ static void rmap_remove(struct kvm *kvm, u64 *spte)
549 return; 549 return;
550 sp = page_header(__pa(spte)); 550 sp = page_header(__pa(spte));
551 page = spte_to_page(*spte); 551 page = spte_to_page(*spte);
552 mark_page_accessed(page); 552 if (*spte & PT_ACCESSED_MASK)
553 mark_page_accessed(page);
553 if (is_writeble_pte(*spte)) 554 if (is_writeble_pte(*spte))
554 kvm_release_page_dirty(page); 555 kvm_release_page_dirty(page);
555 else 556 else