Make KVM guest pages be allocated dynamically and able to be swaped out.
One issue: all inodes returned from anon_inode_getfd are shared,
if one module changes field of the inode, other moduels might break.
Should we introduce a new API to not share inode?
Signed-off-by: Shaohua Li <shaohua.li@xxxxxxxxx>
---
drivers/kvm/kvm.h | 8 +
drivers/kvm/kvm_main.c | 220 +++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 211 insertions(+), 17 deletions(-)
+
+ /*
+ * We just zap vcpu 0's page table. For a SMP guest, we should zap all
+ * vcpus'. It's better shadow page table is per-vm.
+ */
+ if (PagePrivate(page))
+ kvm_mmu_zap_pagetbl(&kvm->vcpus[0], page->index);
+