1
0
Fork 0
alistair23-linux/arch
Ben Gardon 254272ce65 kvm: x86: Add memcg accounting to KVM allocations
There are many KVM kernel memory allocations which are tied to the life of
the VM process and should be charged to the VM process's cgroup. If the
allocations aren't tied to the process, the OOM killer will not know
that killing the process will free the associated kernel memory.
Add __GFP_ACCOUNT flags to many of the allocations which are not yet being
charged to the VM process's cgroup.

Tested:
	Ran all kvm-unit-tests on a 64 bit Haswell machine, the patch
	introduced no new failures.
	Ran a kernel memory accounting test which creates a VM to touch
	memory and then checks that the kernel memory allocated for the
	process is within certain bounds.
	With this patch we account for much more of the vmalloc and slab memory
	allocated for the VM.

There remain a few allocations which should be charged to the VM's
cgroup but are not. In x86, they include:
	vcpu->arch.pio_data
There allocations are unaccounted in this patch because they are mapped
to userspace, and accounting them to a cgroup causes problems. This
should be addressed in a future patch.

Signed-off-by: Ben Gardon <bgardon@google.com>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-02-20 22:48:30 +01:00
..
alpha Kbuild late updates for v4.21 2019-01-06 16:33:10 -08:00
arc ARCv2: lib: memeset: fix doing prefetchw outside of buffer 2019-01-17 16:24:39 -08:00
arm xen: fixes for 5.0-rc6 2019-02-09 09:44:08 -08:00
arm64 ARM: SoC fixes for linux-5.0 2019-02-08 16:23:41 -08:00
c6x arch: unexport asm/shmparam.h for all architectures 2019-02-01 15:46:22 -08:00
csky csky: fixup compile error with CPU 810. 2019-01-10 04:37:37 -08:00
h8300 arch: unexport asm/shmparam.h for all architectures 2019-02-01 15:46:22 -08:00
hexagon arch: unexport asm/shmparam.h for all architectures 2019-02-01 15:46:22 -08:00
ia64 ia64: remove redundant 'export AWK' 2019-01-16 23:31:18 +09:00
m68k for-linus-20190209 2019-02-09 10:26:09 -08:00
microblaze arch: unexport asm/shmparam.h for all architectures 2019-02-01 15:46:22 -08:00
mips mips: cm: reprime error cause 2019-02-07 11:55:24 -08:00
nds32 nds32: remove unneeded code in arch/nds32/Makefile 2019-01-17 23:42:37 +09:00
nios2 arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
openrisc arch: unexport asm/shmparam.h for all architectures 2019-02-01 15:46:22 -08:00
parisc arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
powerpc powerpc fixes for 5.0 #4 2019-02-08 16:04:12 -08:00
riscv riscv: Adjust mmap base address at a third of task size 2019-01-25 10:50:53 -08:00
s390 s390/smp: Fix calling smp_call_ipl_cpu() from ipl CPU 2019-01-11 17:12:03 +01:00
sh Kbuild late updates for v4.21 2019-01-06 16:33:10 -08:00
sparc arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
um Merge branch 'akpm' (patches from Andrew) 2019-01-05 09:16:18 -08:00
unicore32 arch: unexport asm/shmparam.h for all architectures 2019-02-01 15:46:22 -08:00
x86 kvm: x86: Add memcg accounting to KVM allocations 2019-02-20 22:48:30 +01:00
xtensa xtensa: SMP: limit number of possible CPUs by NR_CPUS 2019-01-27 10:04:30 -08:00
.gitignore
Kconfig jump_label: move 'asm goto' support test to Kconfig 2019-01-06 09:46:51 +09:00