aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm_main.c
diff options
context:
space:
mode:
authorIzik Eidus <izike@localhost.localdomain>2007-11-20 04:49:33 -0500
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:53:09 -0500
commitb4231d61807cac8d9d257eb6979c1685fa9a171f (patch)
tree36b2064c0df4a2b2e11c5d9a2221c097bb0c7be9 /drivers/kvm/kvm_main.c
parent2065b3727ecdb64450597d70f7e13af00b85dbd8 (diff)
KVM: MMU: Selectively set PageDirty when releasing guest memory
Improve dirty bit setting for pages that kvm release, until now every page that we released we marked dirty, from now only pages that have potential to get dirty we mark dirty. Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r--drivers/kvm/kvm_main.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 4e1bd9488470..729573b844e5 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -543,13 +543,19 @@ struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn)
543 543
544EXPORT_SYMBOL_GPL(gfn_to_page); 544EXPORT_SYMBOL_GPL(gfn_to_page);
545 545
546void kvm_release_page(struct page *page) 546void kvm_release_page_clean(struct page *page)
547{
548 put_page(page);
549}
550EXPORT_SYMBOL_GPL(kvm_release_page_clean);
551
552void kvm_release_page_dirty(struct page *page)
547{ 553{
548 if (!PageReserved(page)) 554 if (!PageReserved(page))
549 SetPageDirty(page); 555 SetPageDirty(page);
550 put_page(page); 556 put_page(page);
551} 557}
552EXPORT_SYMBOL_GPL(kvm_release_page); 558EXPORT_SYMBOL_GPL(kvm_release_page_dirty);
553 559
554static int next_segment(unsigned long len, int offset) 560static int next_segment(unsigned long len, int offset)
555{ 561{
@@ -1055,7 +1061,7 @@ static struct page *kvm_vm_nopage(struct vm_area_struct *vma,
1055 /* current->mm->mmap_sem is already held so call lockless version */ 1061 /* current->mm->mmap_sem is already held so call lockless version */
1056 page = __gfn_to_page(kvm, pgoff); 1062 page = __gfn_to_page(kvm, pgoff);
1057 if (is_error_page(page)) { 1063 if (is_error_page(page)) {
1058 kvm_release_page(page); 1064 kvm_release_page_clean(page);
1059 return NOPAGE_SIGBUS; 1065 return NOPAGE_SIGBUS;
1060 } 1066 }
1061 if (type != NULL) 1067 if (type != NULL)