作用
初始化
// in kernel/cpu.c
void __init boot_cpu_init(void)
{int cpu = smp_processor_id();set_cpu_online(cpu, true);set_cpu_active(cpu, true);set_cpu_present(cpu, true);set_cpu_possible(cpu, true);
#ifdef CONFIG_SMP__boot_cpu_id = cpu;
#endif
}
定义
include/linux/cpumask.h
typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
即为typedef struct cpumask { unsigned long bits[BITS_TO_LONGS(NR_CPUS)]
} cpumask_t;
kernel/cpu.c
struct cpumask __cpu_possible_mask __read_mostly;
EXPORT_SYMBOL(__cpu_possible_mask);
struct cpumask __cpu_online_mask __read_mostly;
EXPORT_SYMBOL(__cp