[RFC 00/10] KVM: Add TMEM host/guest support

Sasha Levin
2012-06-06T13:06:50Z

This patch series adds support for passing TMEM commands between KVM guests
and the host. This opens the possibility to use TMEM cross-guests and
posibly across hosts with RAMster.

Since frontswap was merged in the 3.4 cycle, the kernel now has all facilities
required to work with TMEM. There is no longer a dependency on out of tree
code.

We can split this patch series into two:

- The guest side, which is basically two shims that proxy mm/cleancache.c
and mm/frontswap.c requests from the guest back to the host. This is done
using a new KVM_HC_TMEM hypercall.

- The host side, which is a rather small shim which connects KVM to zcache.

It's worth noting that this patch series don't have any significant logic in
it, and is mostly a collection of shims to pass TMEM commands across hypercalls.

I ran benchmarks using both the "streaming test" proposed by Avi, and some
general fio tests. Since the fio tests showed similar results to the
streaming test, and no anomalies, here is the summary of the streaming tests:

First, trying to stream a 26GB random file without KVM TMEM:
real 7m36.046s
user 0m17.113s
sys 5m23.809s

And with KVM TMEM:
real 7m36.018s
user 0m17.124s
sys 5m28.391s

- No significant difference.

Now, trying to stream a 16gb file that compresses nicely, first without KVM TMEM:
real 5m10.299s
user 0m11.311s
sys 3m40.139s

And a second run without dropping cache:
real 4m33.951s
user 0m10.869s
sys 3m13.789s

Now, with KVM TMEM:
real 4m55.528s
user 0m11.119s
sys 3m33.243s

And a second run:
real 2m53.713s
user 0m7.971s
sys 2m29.807s

So KVM TMEM shows a nice performance increase once it can store pages on the host.

Sasha Levin (10):
KVM: reintroduce hc_gpa
KVM: wire up the TMEM HC
zcache: export zcache interface
KVM: add KVM TMEM entries in the appropriate config menu entry
KVM: bring in general tmem definitions
zcache: move out client declaration and add a KVM client
KVM: add KVM TMEM host side interface
KVM: add KVM TMEM guest support
KVM: support guest side cleancache
KVM: support guest side frontswap

arch/x86/kvm/Kconfig | 1 +
arch/x86/kvm/Makefile | 2 +
arch/x86/kvm/tmem/Kconfig | 43 +++++++++++
arch/x86/kvm/tmem/Makefile | 6 ++
arch/x86/kvm/tmem/cleancache.c | 120 +++++++++++++++++++++++++++++
arch/x86/kvm/tmem/frontswap.c | 139 ++++++++++++++++++++++++++++++++++
arch/x86/kvm/tmem/guest.c | 95 +++++++++++++++++++++++
arch/x86/kvm/tmem/guest.h | 11 +++
arch/x86/kvm/tmem/host.c | 78 +++++++++++++++++++
arch/x86/kvm/tmem/host.h | 20 +++++
arch/x86/kvm/tmem/tmem.h | 62 +++++++++++++++
arch/x86/kvm/x86.c | 13 +++
drivers/staging/zcache/zcache-main.c | 48 ++++++++++--
drivers/staging/zcache/zcache.h | 20 +++++
include/linux/kvm_para.h | 1 +
15 files changed, 652 insertions(+), 7 deletions(-)
create mode 100644 arch/x86/kvm/tmem/Kconfig
create mode 100644 arch/x86/kvm/tmem/Makefile
create mode 100644 arch/x86/kvm/tmem/cleancache.c
create mode 100644 arch/x86/kvm/tmem/frontswap.c
create mode 100644 arch/x86/kvm/tmem/guest.c
create mode 100644 arch/x86/kvm/tmem/guest.h
create mode 100644 arch/x86/kvm/tmem/host.c
create mode 100644 arch/x86/kvm/tmem/host.h
create mode 100644 arch/x86/kvm/tmem/tmem.h
create mode 100644 drivers/staging/zcache/zcache.h

--
1.7.8.6