[PATCH v2 0/4] mm: new function to forbid zeropage mappings for a process
From: Dominik Dingel
Date: Wed Oct 22 2014 - 04:31:28 EST
s390 has the special notion of storage keys which are some sort of page flags
associated with physical pages and live outside of direct addressable memory.
These storage keys can be queried and changed with a special set of instructions.
The mentioned instructions behave quite nicely under virtualization, if there is:
- an invalid pte, then the instructions will work on memory in the host page table
- a valid pte, then the instructions will work with the real storage key
Thanks to Martin with his software reference and dirty bit tracking,
the kernel does not issue any storage key instructions as now a
software based approach will be taken, on the other hand distributions
in the wild are currently using them.
However, for virtualized guests we still have a problem with guest pages
mapped to zero pages and the kernel same page merging.
With each one multiple guest pages will point to the same physical page
and share the same storage key.
Let's fix this by introducing a new function which s390 will define to
forbid new zero page mappings. If the guest issues a storage key related
instruction we flag the mm_struct, drop existing zero page mappings
and unmerge the guest memory.
v1 -> v2:
- Following Dave and Paolo suggestion removing the vma flag
Dominik Dingel (4):
s390/mm: recfactor global pgste updates
mm: introduce mm_forbids_zeropage function
s390/mm: prevent and break zero page mappings in case of storage keys
s390/mm: disable KSM for storage key enabled pages
arch/s390/include/asm/mmu.h | 2 +
arch/s390/include/asm/pgalloc.h | 2 -
arch/s390/include/asm/pgtable.h | 17 +++-
arch/s390/kvm/kvm-s390.c | 2 +-
arch/s390/kvm/priv.c | 17 ++--
arch/s390/mm/pgtable.c | 180 ++++++++++++++++++----------------------
include/linux/mm.h | 4 +
mm/huge_memory.c | 2 +-
mm/memory.c | 2 +-
9 files changed, 117 insertions(+), 111 deletions(-)
--
1.8.5.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/