Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib/stackdepot: Use page allocator if both slab and memblock is unava…
…ilable After commit 2dba5eb ("lib/stackdepot: allow optional init and stack_table allocation by kvmalloc()"), stack_depot_init() is called later if CONFIG_STACKDEPOT_ALWAYS_INIT=n to remove unnecessary memory usage. It allocates stack_table using memblock_alloc() or kvmalloc() depending on availability of slab allocator. But when stack_depot_init() is called while creating boot slab caches, both slab allocator and memblock is not available. So kernel crashes. Allocate stack_table from page allocator when both slab allocator and memblock is unavailable. Limit size of stack_table when using page allocator because vmalloc() is also unavailable in kmem_cache_init(). it must not be larger than (PAGE_SIZE << (MAX_ORDER - 1)). This patch was tested on both CONFIG_STACKDEPOT_ALWAYS_INIT=y and n. Fixes: 2dba5eb ("lib/stackdepot: allow optional init and stack_table allocation by kvmalloc()") Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
- Loading branch information