RE: [PATCH 1/1] arm64: add support for PAGE_SIZE aligned kernel stack

From: Maninder Singh
Date: Fri Aug 07 2020 - 07:25:43 EST



Hi Mark,

>>If you are seeing issues with the current stack size, can you please
>>explain that in more detail? Where are you seeing problems? Which
>>configuration options do you have selected?
>>

We checked on our system with netflix and youtube 4K videos running
max stack consumption was 7 KB:

sh-3.2# cat /sys/kernel/debug/tracing/stack_max_size
7312

Thus we thought 16KB wil waste a lot of memory for our ARM64 target,
and 8KB can be less in some exceptional case.
So we decided for 12 KB change.


>>I'm not keen on making kernel stack sizes configurable as it's not
>>currently possible for the person building the kernel to figure out a
>>safe size (and if this were possible, it's be better to handle this
>>automatically).
>>

Ok, can we do something else?, like not making it configurable,
but do code changes to support it for PAGE_SIZE aligned stacks
rather than power of 2 alignement.

Although with configurable also, it depends on VMAP stack,
so user will have stack exhaust exception and can increase acccordingly also.

>
>Motivation behind these changes is saving memory on our system.
>Our system runs around 2500 threads concurrently so saving 4Kb
>might help us in saving 10MB memory.
>
>To ensure 12KB is sufficient for our system we have used stack tracing and
>realised maximum stack used is not more than 9KB.
> /sys/kernel/tracing/stack_max_size
>
>Tracing interface defined by kernel to track maximum stack size can be used
>by others to decide appropriate stack size.
>

Thanks