arm64: mm: Set stack size from the kernel command line
Allow changing the runtime stack size by passing the command line
argument `kernel_thread_shift=`. This allows the user to configure
the stack size down to the PAGE_SIZE to save memory. Note that memory
will be saved only for the newly created tasks.
Memory is saved dynamically when a task is created. No memory changes
take effect at compile time.
CONFIG_ARCH_HAS_VARIABLE_STACK_SIZE must be set to override the generic
kernel_thread_shift, and this config does not affect the size of the
stack itself.
A lower bound on the kernel_thread_shift is placed at 13 corresponding
to an 8K stack which is the minimum value for the stack to work on
arm64, an upper bound on kernel_thread_shift is placed at 14
corresponding to the default 16K stack size to make sure that the
vmap_stack configuration does not try to get pages out of order.
Testing on Android verified that the 8K stack size works and does not
result in a stack overflow.
Signed-off-by: Mostafa Saleh <smostafa@google.com>
5 files changed