On 08/05/2018 07:16, Christian Borntraeger wrote: > On 05/08/2018 07:14 AM, Paul Mackerras wrote: >> On Mon, May 07, 2018 at 03:18:46PM -0700, Marc Orr wrote: >>> The kvm struct is (currently) tens of kilo-bytes, which turns out to be a >>> large amount of memory to allocate contiguously via kzalloc. Thus, this >>> patch changes the kzalloc to a vzalloc, so that the memory allocation is >>> less likely to fail in resource-constrained environments. >> >> This will break HV KVM on powerpc, which needs the KVM struct to be >> physically contiguous and in the linear mapping. We'll need to add >> #define __KVM_HAVE_ARCH_VM_ALLOC to arch/powerpc/include/asm/kvm_host.h >> and the kzalloc/kfree variant to arch/powerpc/kvm/powerpc.c much like >> you did on arm. > > In the end I also want kmalloc for s390 (since we do not need the vmalloc for > s390 as we are < 16kb). > > So Paolo, > can we turn things around and only use vmalloc for x86? > The other idea that the #define would pick kzalloc vs. vzalloc (instead of enabling a custom kvm_arch_alloc_vm) would be even better I think. Paolo