android_kernel_samsung_msm8976/arch
Takuya Yoshikawa 60c34612b7 KVM: Switch to srcu-less get_dirty_log()
We have seen some problems of the current implementation of
get_dirty_log() which uses synchronize_srcu_expedited() for updating
dirty bitmaps; e.g. it is noticeable that this sometimes gives us ms
order of latency when we use VGA displays.

Furthermore the recent discussion on the following thread
    "srcu: Implement call_srcu()"
    http://lkml.org/lkml/2012/1/31/211
also motivated us to implement get_dirty_log() without SRCU.

This patch achieves this goal without sacrificing the performance of
both VGA and live migration: in practice the new code is much faster
than the old one unless we have too many dirty pages.

Implementation:

The key part of the implementation is the use of xchg() operation for
clearing dirty bits atomically.  Since this allows us to update only
BITS_PER_LONG pages at once, we need to iterate over the dirty bitmap
until every dirty bit is cleared again for the next call.

Although some people may worry about the problem of using the atomic
memory instruction many times to the concurrently accessible bitmap,
it is usually accessed with mmu_lock held and we rarely see concurrent
accesses: so what we need to care about is the pure xchg() overheads.

Another point to note is that we do not use for_each_set_bit() to check
which ones in each BITS_PER_LONG pages are actually dirty.  Instead we
simply use __ffs() in a loop.  This is much faster than repeatedly call
find_next_bit().

Performance:

The dirty-log-perf unit test showed nice improvements, some times faster
than before, except for some extreme cases; for such cases the speed of
getting dirty page information is much faster than we process it in the
userspace.

For real workloads, both VGA and live migration, we have observed pure
improvements: when the guest was reading a file during live migration,
we originally saw a few ms of latency, but with the new method the
latency was less than 200us.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
2012-04-08 12:50:00 +03:00
..
alpha kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
arm kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
avr32 kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
blackfin kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
c6x kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
cris Merge branch 'x86-x32-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-03-29 18:12:23 -07:00
frv kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
h8300 kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
hexagon kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
ia64 kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
m32r Merge branch 'x86-x32-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-03-29 18:12:23 -07:00
m68k kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
microblaze kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
mips kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
mn10300 kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
openrisc kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
parisc kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
powerpc kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
s390 kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
score kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
sh kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
sparc kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
tile kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
um kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
unicore32 kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
x86 KVM: Switch to srcu-less get_dirty_log() 2012-04-08 12:50:00 +03:00
xtensa kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
.gitignore
Kconfig Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile 2012-03-29 14:49:45 -07:00