• T
    KVM: Optimize dirty logging by rmap_write_protect() · 95d4c16c
    Takuya Yoshikawa 提交于
    Currently, write protecting a slot needs to walk all the shadow pages
    and checks ones which have a pte mapping a page in it.
    
    The walk is overly heavy when dirty pages in that slot are not so many
    and checking the shadow pages would result in unwanted cache pollution.
    
    To mitigate this problem, we use rmap_write_protect() and check only
    the sptes which can be reached from gfns marked in the dirty bitmap
    when the number of dirty pages are less than that of shadow pages.
    
    This criterion is reasonable in its meaning and worked well in our test:
    write protection became some times faster than before when the ratio of
    dirty pages are low and was not worse even when the ratio was near the
    criterion.
    
    Note that the locking for this write protection becomes fine grained.
    The reason why this is safe is descripted in the comments.
    Signed-off-by: NTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
    Signed-off-by: NAvi Kivity <avi@redhat.com>
    95d4c16c
kvm_host.h 24.8 KB