From fcd6dbac9267c1c06a205ad8bb4bd027c0ace7f7 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Thu, 3 Apr 2008 12:02:21 +0300 Subject: 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 --- arch/x86/kvm/mmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/x86/kvm') diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 1594ee06c92..5c4c16662c6 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) return; sp = page_header(__pa(spte)); page = spte_to_page(*spte); - mark_page_accessed(page); + if (*spte & PT_ACCESSED_MASK) + mark_page_accessed(page); if (is_writeble_pte(*spte)) kvm_release_page_dirty(page); else -- cgit v1.2.3