Re: [PATCH kvm-unit-tests 16/18] arm: only align CPU stacks to one page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <pbonzini@xxxxxxxxxx>
>> ---
>>  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



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux