1.. SPDX-License-Identifier: GPL-2.0
2.. include:: ../disclaimer-zh_TW.rst
3
4:Original: Documentation/admin-guide/cputopology.rst
5
6:������:
7
8  ��������� Tang Yizhou <tangyeechou@gmail.com>
9
10==========================
11������������sysfs���CPU������������
12==========================
13
14CPU������������������sysfs���������������������������������������������������/proc/cpuinfo���������������������������
15/sys/devices/system/cpu/cpuX/topology/������������ABI���������
16Documentation/ABI/stable/sysfs-devices-system-cpu���
17
18drivers/base/topology.c���������������������������������������������������������������die���cluster���book���
19draw������������������������������������������������������������������������������������������������������
20
21������������������������������������������������������include/asm-XXX/topology.h���������������������������������::
22
23	#define topology_physical_package_id(cpu)
24	#define topology_die_id(cpu)
25	#define topology_cluster_id(cpu)
26	#define topology_core_id(cpu)
27	#define topology_book_id(cpu)
28	#define topology_drawer_id(cpu)
29	#define topology_sibling_cpumask(cpu)
30	#define topology_core_cpumask(cpu)
31	#define topology_cluster_cpumask(cpu)
32	#define topology_die_cpumask(cpu)
33	#define topology_book_cpumask(cpu)
34	#define topology_drawer_cpumask(cpu)
35
36``**_id macros`` ������������int���
37``**_cpumask macros`` ������������ ``(const) struct cpumask *`` ���������������������
38``**_siblings`` sysfs���������������������topology_sibling_cpumask()���������thread_siblings
39������������
40
41���������������������������������������������include/linux/topology.h������������������������������������������������
42������������include/asm-XXX/topology.h���������:
43
441) topology_physical_package_id: -1
452) topology_die_id: -1
463) topology_cluster_id: -1
474) topology_core_id: 0
485) topology_book_id: -1
496) topology_drawer_id: -1
507) topology_sibling_cpumask: ���������CPU
518) topology_core_cpumask: ���������CPU
529) topology_cluster_cpumask: ���������CPU
5310) topology_die_cpumask: ���������CPU
5411) topology_book_cpumask:  ���������CPU
5512) topology_drawer_cpumask: ���������CPU
56
57���������CPU���������������/sys/devices/system/cpu������������������������������������������������������������������
58������������"[]"���������
59
60    =========== ==================================================================
61    kernel_max: ���������������������������CPU������������[NR_CPUS-1]
62
63    offline:    ������������������������������������������������CPU������������������������kernel_max���
64                ������������������CPU���[~cpu_online_mask + cpus >= NR_CPUS]
65
66    online:     ���������CPU������������������������[cpu_online_mask]
67
68    possible:   ���������������������CPU���������������CPU������������������������������
69                [cpu_possible_mask]
70
71    present:    ������������������������������CPU���[cpu_present_mask]
72    =========== ==================================================================
73
74������������������������cpulist_parse()������[������ <linux/cpumask.h>]������������������������
75
76���������������������������64���CPU���������CPU 32-63���������kernel_max������������NR_CPUS������������32���
77������������������������0..31���������������CPU2���4-31������������������������������������������������������������
78present���possible::
79
80     kernel_max: 31
81        offline: 2,4-31,32-63
82         online: 0-1,3
83       possible: 0-31
84        present: 0-31
85
86���������������NR_CPUS������������128���������������������������possible_cpus=144���������������4���CPU���
87CPU2���������������������������������������������������������CPU���::
88
89     kernel_max: 127
90        offline: 2,4-127,128-143
91         online: 0-1,3
92       possible: 0-127
93        present: 0-3
94
95������Documentation/core-api/cpu_hotplug.rst���������������������possible_cpus=NUM������������
96������������������cpumask������������
97
98