]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: avoid unnecessary bitmap allocation when memslot is clean
authorTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Wed, 28 Apr 2010 09:50:36 +0000 (18:50 +0900)
committerAvi Kivity <avi@redhat.com>
Sun, 1 Aug 2010 07:35:27 +0000 (10:35 +0300)
commitf6edec848d9479eb572b3c8a2a7e55af934b59e8
tree13341c1b1fcd6d4eeb39576c75417cccbcdee748
parentcdb59521d6651699dd184d74a5faf4454ed504be
KVM: x86: avoid unnecessary bitmap allocation when memslot is clean

Although we always allocate a new dirty bitmap in x86's get_dirty_log(),
it is only used as a zero-source of copy_to_user() and freed right after
that when memslot is clean. This patch uses clear_user() instead of doing
this unnecessary zero-source allocation.

Performance improvement: as we can expect easily, the time needed to
allocate a bitmap is completely reduced. In my test, the improved ioctl
was about 4 to 10 times faster than the original one for clean slots.
Furthermore, reducing memory allocations and copies will produce good
effects to caches too.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/x86.c