]> err.no Git - linux-2.6/commitdiff
KVM: MMU: Only mark_page_accessed() if the page was accessed by the guest
authorAvi Kivity <avi@qumranet.com>
Thu, 3 Apr 2008 09:02:21 +0000 (12:02 +0300)
committerAvi Kivity <avi@qumranet.com>
Sun, 27 Apr 2008 09:00:57 +0000 (12:00 +0300)
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>
arch/x86/kvm/mmu.c

index 1594ee06c920cd5f25192832d28fbeb5e6aace8b..5c4c16662c6831752412c024a83ff9522454dac9 100644 (file)
@@ -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