kernel: each mem slab buffer has its own section attribute

This attaches a unique section attribute for each mem slab
buffer defined with K_MEM_SLAB_DEFINE(). This allows them
to be placed as needed via linker scripts. This is useful
for demand paging as developers can choose which memory
slab buffer is pinned in memory.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2021-07-19 12:10:54 -07:00 committed by Christopher Friedt
commit e6f168c1bc

View file

@ -4812,7 +4812,8 @@ struct k_mem_slab {
* @param slab_align Alignment of the memory slab's buffer (power of 2).
*/
#define K_MEM_SLAB_DEFINE(name, slab_block_size, slab_num_blocks, slab_align) \
char __noinit __aligned(WB_UP(slab_align)) \
char __noinit_named(k_mem_slab_buf_##name) \
__aligned(WB_UP(slab_align)) \
_k_mem_slab_buf_##name[(slab_num_blocks) * WB_UP(slab_block_size)]; \
STRUCT_SECTION_ITERABLE(k_mem_slab, name) = \
Z_MEM_SLAB_INITIALIZER(name, _k_mem_slab_buf_##name, \