Commit fcd6dbac authored by Avi Kivity's avatar Avi Kivity
Browse files

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: default avatarAvi Kivity <avi@qumranet.com>
parent d39f13b0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -549,6 +549,7 @@ static void rmap_remove(struct kvm *kvm, u64 *spte)
		return;
	sp = page_header(__pa(spte));
	page = spte_to_page(*spte);
	if (*spte & PT_ACCESSED_MASK)
		mark_page_accessed(page);
	if (is_writeble_pte(*spte))
		kvm_release_page_dirty(page);