On 10/14/24 12:58, Ryan Roberts wrote: > THREAD_SIZE defines the size of a kernel thread stack. To date, it has > been set at compile-time. However, when using vmap stacks, the size must > be a multiple of PAGE_SIZE, and given we are in the process of > supporting boot-time page size, we must also do the same for > THREAD_SIZE. > > The alternative would be to define THREAD_SIZE for the largest supported > page size, but this would waste memory when using a smaller page size. > For example, arm64 requires THREAD_SIZE to be 16K, but when using 64K > pages and a vmap stack, we must increase the size to 64K. If we required > 64K when 4K or 16K page size was in use, we would waste 48K per kernel > thread. > > So let's refactor to allow THREAD_SIZE to not be a compile-time > constant. THREAD_SIZE_MAX (and THREAD_ALIGN_MAX) are introduced to > manage the limits, as is done for PAGE_SIZE. > > When THREAD_SIZE is a compile-time constant, behaviour and code size > should be equivalent. > > Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx> Acked-by: Vlastimil Babka <vbabka@xxxxxxx>