Slab allocator
include/mem/slab.h View source View on GitHubStructs
Section titled “Structs”slab_elcm_candidate
Section titled “slab_elcm_candidate”struct slab_elcm_candidate {
size_t pages;
size_t bitmap_size_bytes;
size_t obj_count;
}; slab_size_constant
Section titled “slab_size_constant”struct slab_size_constant {
const char *name;
size_t size;
size_t align;
struct list_head list;
struct {
struct slab_elcm_candidate cand;
} internal;
}; Functions
Section titled “Functions”slab_allocator_init
Section titled “slab_allocator_init”void slab_allocator_init(); slab_domain_init
Section titled “slab_domain_init”void slab_domain_init(void); slab_domains_print
Section titled “slab_domains_print”void slab_domains_print(); slab_domain_init_late
Section titled “slab_domain_init_late”void slab_domain_init_late(); Macros
Section titled “Macros”SLAB_SIZE_REGISTER
Section titled “SLAB_SIZE_REGISTER”#define SLAB_SIZE_REGISTER(n, s, a) \
LINKER_SECTION_OBJECT(struct slab_size_constant, slab_sizes) \
slab_size_constant_##n = { \
.name = #n, \
.size = s, \
.align = a, \
.list = LIST_HEAD_INIT(slab_size_constant_##n.list), \
.internal = {{0}}, \
} SLAB_SIZE_REGISTER_FOR_STRUCT
Section titled “SLAB_SIZE_REGISTER_FOR_STRUCT”#define SLAB_SIZE_REGISTER_FOR_STRUCT(sname, al) \
SLAB_SIZE_REGISTER(sname, sizeof(struct sname), al) SLAB_OBJ_ALIGN_DEFAULT
Section titled “SLAB_OBJ_ALIGN_DEFAULT”#define SLAB_OBJ_ALIGN_DEFAULT 8u