From: Paolo Bonzini Subject: Re: [PATCH kvm-unit-tests 16/18] arm: only align CPU stacks to one page Date: Wed, 25 Oct 2017 11:23:01 +0200 Message-ID: References: <20171024152145.28456-1-pbonzini@redhat.com> <20171024152145.28456-17-pbonzini@redhat.com> <20171025084008.xfr7dzqc6v6cioye@kamzik.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, david@redhat.com To: Andrew Jones Return-path: Received: from mail-wm0-f65.google.com ([74.125.82.65]:51285 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932278AbdJYJXE (ORCPT ); Wed, 25 Oct 2017 05:23:04 -0400 Received: by mail-wm0-f65.google.com with SMTP id b9so588002wmh.0 for ; Wed, 25 Oct 2017 02:23:04 -0700 (PDT) In-Reply-To: <20171025084008.xfr7dzqc6v6cioye@kamzik.brq.redhat.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 25/10/2017 10:40, Andrew Jones wrote: > On Tue, Oct 24, 2017 at 05:21:43PM +0200, Paolo Bonzini wrote: >> vmalloc is not able to provide allocations with alignment greater than >> PAGE_SIZE, so avoid them. >> >> Signed-off-by: Paolo Bonzini >> --- >> lib/arm/asm/thread_info.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/lib/arm/asm/thread_info.h b/lib/arm/asm/thread_info.h >> index 9f0c14d..c2ecebb 100644 >> --- a/lib/arm/asm/thread_info.h >> +++ b/lib/arm/asm/thread_info.h >> @@ -38,7 +38,7 @@ >> >> static inline void *thread_stack_alloc(void) >> { >> - void *sp = memalign(THREAD_SIZE, THREAD_SIZE); >> + void *sp = memalign(PAGE_SIZE, THREAD_SIZE); >> return sp + THREAD_START_SP; >> } >> > > This reduces all the secondary cpu's stacks on arm from 16K to 4K. > Also, THREAD_SIZE is page aligned, so I'm wondering what's breaking > here? No, they stay 16K but only page-aligned; the prototype is void *memalign(size_t alignment, size_t size) vmalloc is not able to satisfy memalign with alignment greater than a page size, but the memory blocks can be as large as you want. Paolo