Re: [PATCH] mmu_notifier, kvm: Introduce dirty bit tracking in spte and mmu notifier to help KSM dirty bit tracking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/22/2011 1:43 PM, Avi Kivity wrote:
On 06/21/2011 04:32 PM, Nai Xia wrote:
Introduced kvm_mmu_notifier_test_and_clear_dirty(), kvm_mmu_notifier_dirty_update() and their mmu_notifier interfaces to support KSM dirty bit tracking, which brings
significant performance gain in volatile pages scanning in KSM.
Currently, kvm_mmu_notifier_dirty_update() returns 0 if and only if intel EPT is enabled to indicate that the dirty bits of underlying sptes are not updated by
hardware.



Can you quantify the performance gains?

+int kvm_test_and_clear_dirty_rmapp(struct kvm *kvm, unsigned long *rmapp,
+                   unsigned long data)
+{
+    u64 *spte;
+    int dirty = 0;
+
+    if (!shadow_dirty_mask) {
+        WARN(1, "KVM: do NOT try to test dirty bit in EPT\n");
+        goto out;
+    }
+
+    spte = rmap_next(kvm, rmapp, NULL);
+    while (spte) {
+        int _dirty;
+        u64 _spte = *spte;
+        BUG_ON(!(_spte&  PT_PRESENT_MASK));
+        _dirty = _spte&  PT_DIRTY_MASK;
+        if (_dirty) {
+            dirty = 1;
+            clear_bit(PT_DIRTY_SHIFT, (unsigned long *)spte);
+        }

Racy.  Also, needs a tlb flush eventually.

Hi, one of the issues is that the whole point of this patch is not do tlb flush eventually, But I see your point, because other users will not expect such behavior, so maybe there is need into a parameter
flush_tlb=?, or add another mmu notifier call?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]