On Wed, Sep 23, 2009 at 09:47:18PM +0300, Izik Eidus wrote: > + if (need_flush) > + kvm_flush_remote_tlbs(kvm); need_flush can be return to kvm_mmu_notifier_change_pte to defer the tlb flush after dropping the spin lock I think. We are forced to flush the tlb inside spin_lock in kvm normal context because that stops the VM from freeing the page (it hangs on the mmu_lock taken by kvm invalidate_page/change_pte) so we can unmap tons of sptes and do a single kvm tlb flush that covers them all (by keeping both actions under the mmu_lock), but in mmu notifier context the pages can't be freed from under the guest, so we can flush the tlb flushing the tlb before making the page freeable, because both old and new page in do_wp_page are still pinned and can't be freed and reused from under us even if we release mmu_lock before tlb flush. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html