Skip to content

Commit

Permalink
KVM: MMU: Only mark_page_accessed() if the page was accessed by the g…
Browse files Browse the repository at this point in the history
…uest

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>
  • Loading branch information
Avi Kivity committed Apr 27, 2008
1 parent d39f13b commit fcd6dba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/x86/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fcd6dba

Please sign in to comment.