根据 CPU 的物理属性 , 可以将 CPU 分为如下几类 :
Linux 内核中 , 对 CPU 处理器的分类 :
Linux 内核中 , 通过 bitmap 管理 CPU 处理器 , 并且在 Linux 源码中的 linux-5.6.18includelinuxcpumask.h
头文件源码中 , 定义了 CPU 的四种状态 :
/** The following particular system cpumasks and operations manage* possible, present, active and online cpus.** cpu_possible_mask- has bit 'cpu' set iff cpu is populatable* cpu_present_mask - has bit 'cpu' set iff cpu is populated* cpu_online_mask - has bit 'cpu' set iff cpu available to scheduler* cpu_active_mask - has bit 'cpu' set iff cpu available to migration** If !CONFIG_HOTPLUG_CPU, present == possible, and active == online.** The cpu_possible_mask is fixed at boot time, as the set of CPU id's* that it is possible might ever be plugged in at anytime during the* life of that system boot. The cpu_present_mask is dynamic(*),* representing which CPUs are currently plugged in. And* cpu_online_mask is the dynamic subset of cpu_present_mask,* indicating those CPUs available for scheduling.** If HOTPLUG is enabled, then cpu_possible_mask is forced to have* all NR_CPUS bits set, otherwise it is just the set of CPUs that* ACPI reports present at boot.** If HOTPLUG is enabled, then cpu_present_mask varies dynamically,* depending on what ACPI reports as currently plugged in, otherwise* cpu_present_mask is just a copy of cpu_possible_mask.** (*) Well, cpu_present_mask is dynamic in the hotplug case. If not* hotplug, it's a copy of cpu_possible_mask, hence fixed at boot.** Subtleties:* 1) UP arch's (NR_CPUS == 1, CONFIG_SMP not defined) hardcode* assumption that their single CPU is online. The UP* cpu_{online,possible,present}_masks are placebos. Changing them* will have no useful affect on the following num_*_cpus()* and cpu_*() macros in the UP case. This ugliness is a UP* optimization - don't waste any instructions or memory references* asking if you're online or how many CPUs there are if there is* only one CPU.*/extern struct cpumask __cpu_possible_mask;
extern struct cpumask __cpu_online_mask;
extern struct cpumask __cpu_present_mask;
extern struct cpumask __cpu_active_mask;
#define cpu_possible_mask ((const struct cpumask *)&__cpu_possible_mask)
#define cpu_online_mask ((const struct cpumask *)&__cpu_online_mask)
#define cpu_present_mask ((const struct cpumask *)&__cpu_present_mask)
#define cpu_active_mask ((const struct cpumask *)&__cpu_active_mask)
本文发布于:2024-02-03 03:42:32,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170690295048424.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |