Domains
include/smp/domain.h View source View on GitHub NOTE
Definition of a “domain”
Domains are a first-class topology abstraction used to group CPUs by NUMA nodes when present or by a fixed number on UMA systems
The premise: kernels benefit from NUMA awareness, however, the benefits reaped by NUMA also benefit UMA systems. For instance, memory allocators that are NUMA aware get better memory locality AND lower lock contention, however, under UMA, the benefit of lower lock contention, and potentially better cache performance are helpful.
Because NUMA logic already exists, we can reuse the logic that handles NUMA systems with UMA systems, and reap the benefits without NUMA.
Structs
Section titled “Structs”domain
Section titled “domain” struct domain (7 fields) source
Functions
Section titled “Functions”domain_init
Section titled “domain_init”void domain_init(void) source domain_create_cpu_mask
Section titled “domain_create_cpu_mask”domain_set_cpu_mask
Section titled “domain_set_cpu_mask”domain_idle
Section titled “domain_idle”numa_node_for_cpu
Section titled “numa_node_for_cpu”numa_node_t numa_node_for_cpu(cpu_id_t cpu) source domain_for_cpu
Section titled “domain_for_cpu”domain_id_t domain_for_cpu(cpu_id_t cpu) source domain_init_after_smp
Section titled “domain_init_after_smp”void domain_init_after_smp(void) source domain_caller_verify
Section titled “domain_caller_verify”void domain_caller_verify(enum topology_caller caller) source domain_dump
Section titled “domain_dump”void domain_dump(void) source domain_local
Section titled “domain_local”struct domain * domain_local(enum topology_caller c) source domain_local_id
Section titled “domain_local_id”domain_id_t domain_local_id(enum topology_caller c) source Macros
Section titled “Macros”CORES_PER_DOMAIN
Section titled “CORES_PER_DOMAIN”#define CORES_PER_DOMAIN 4 source For UMA: TODO: we likely want this to be command line configurable/adjusted at boot time
domain_for_each_domain
Section titled “domain_for_each_domain”#define domain_for_each_domain(dom_) source Expansion
#define domain_for_each_domain(dom_) \
for (domain_id_t __dom_idx = 0; \
__dom_idx < global.domain_count && \
(((dom_) = global.domains[__dom_idx]), true); \
__dom_idx++) domain_for_each_domain_id
Section titled “domain_for_each_domain_id”#define domain_for_each_domain_id(id_) source Expansion
#define domain_for_each_domain_id(id_) \
for (domain_id_t __dom_id_idx = 0; \
__dom_id_idx < global.domain_count && \
(((id_) = global.domains[__dom_id_idx]->id), true); \
__dom_id_idx++) domain_for_each_core
Section titled “domain_for_each_core”#define domain_for_each_core(pos_, dom_) source Expansion
#define domain_for_each_core(pos_, dom_) \
for (size_t __core_idx = 0; __core_idx < (dom_)->num_cores && \
(((pos_) = (dom_)->cores[__core_idx]), true); \
__core_idx++) domain_for_each_core_id
Section titled “domain_for_each_core_id”#define domain_for_each_core_id(pos_, dom_) source Expansion
#define domain_for_each_core_id(pos_, dom_) \
for (size_t __core_id_idx = 0; \
__core_id_idx < (dom_)->num_cores && \
(((pos_) = (dom_)->cores[__core_id_idx]->id), true); \
__core_id_idx++) domain_for_each_core_local
Section titled “domain_for_each_core_local”#define domain_for_each_core_local(pos_, clr_) source Expansion
#define domain_for_each_core_local(pos_, clr_) \
domain_for_each_core(pos_, smp_core(clr_)->domain)