Re: [PATCH V4 8/8] riscv: Add config of thread stack size

From: Arnd Bergmann
Date: Tue Sep 20 2022 - 03:18:16 EST


On Tue, Sep 20, 2022, at 2:46 AM, Guo Ren wrote:

> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index dfe600f3526c..8def456f328c 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -442,6 +442,16 @@ config IRQ_STACKS
> Add independent irq & softirq stacks for percpu to prevent
> kernel stack
> overflows. We may save some memory footprint by disabling IRQ_STACKS.
>
> +config THREAD_SIZE
> + int "Kernel stack size (in bytes)" if EXPERT
> + range 4096 65536
> + default 8192 if 32BIT && !KASAN
> + default 32768 if 64BIT && KASAN
> + default 16384
> + help
> + Specify the Pages of thread stack size (from 4KB to 64KB), which also
> + affects irq stack size, which is equal to thread stack size.

I still think this should be guarded in a way that prevents
setting the stack to smaller than default values unless VMAP_STACK
is set as well.

Arnd