Go to the documentation of this file.
27 #ifndef _LINUX_TOPOLOGY_H
28 #define _LINUX_TOPOLOGY_H
31 #include <linux/bitops.h>
35 #include <asm/topology.h>
37 #ifndef node_has_online_mem
38 #define node_has_online_mem(nid) (1)
42 #define nr_cpus_node(node) cpumask_weight(cpumask_of_node(node))
45 #define for_each_node_with_cpus(node) \
46 for_each_online_node(node) \
47 if (nr_cpus_node(node))
52 #define LOCAL_DISTANCE 10
53 #define REMOTE_DISTANCE 20
55 #define node_distance(from,to) ((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE)
57 #ifndef RECLAIM_DISTANCE
63 #define RECLAIM_DISTANCE 30
65 #ifndef PENALTY_FOR_NODE_WITH_CPUS
66 #define PENALTY_FOR_NODE_WITH_CPUS (1)
81 #ifdef CONFIG_SCHED_SMT
85 #define ARCH_HAS_SCHED_WAKE_IDLE
87 #ifndef SD_SIBLING_INIT
88 #define SD_SIBLING_INIT (struct sched_domain) { \
92 .imbalance_pct = 110, \
94 .flags = 1*SD_LOAD_BALANCE \
95 | 1*SD_BALANCE_NEWIDLE \
100 | 1*SD_SHARE_CPUPOWER \
101 | 1*SD_SHARE_PKG_RESOURCES \
103 | 0*SD_PREFER_SIBLING \
104 | arch_sd_sibling_asym_packing() \
106 .last_balance = jiffies, \
107 .balance_interval = 1, \
113 #ifdef CONFIG_SCHED_MC
116 #define SD_MC_INIT (struct sched_domain) { \
120 .imbalance_pct = 125, \
121 .cache_nice_tries = 1, \
126 .flags = 1*SD_LOAD_BALANCE \
127 | 1*SD_BALANCE_NEWIDLE \
128 | 1*SD_BALANCE_EXEC \
129 | 1*SD_BALANCE_FORK \
130 | 0*SD_BALANCE_WAKE \
132 | 0*SD_SHARE_CPUPOWER \
133 | 1*SD_SHARE_PKG_RESOURCES \
136 .last_balance = jiffies, \
137 .balance_interval = 1, \
144 #define SD_CPU_INIT (struct sched_domain) { \
148 .imbalance_pct = 125, \
149 .cache_nice_tries = 1, \
156 .flags = 1*SD_LOAD_BALANCE \
157 | 1*SD_BALANCE_NEWIDLE \
158 | 1*SD_BALANCE_EXEC \
159 | 1*SD_BALANCE_FORK \
160 | 0*SD_BALANCE_WAKE \
162 | 0*SD_SHARE_CPUPOWER \
163 | 0*SD_SHARE_PKG_RESOURCES \
165 | 1*SD_PREFER_SIBLING \
167 .last_balance = jiffies, \
168 .balance_interval = 1, \
172 #ifdef CONFIG_SCHED_BOOK
174 #error Please define an appropriate SD_BOOK_INIT in include/asm/topology.h!!!
178 #ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID
192 return per_cpu(numa_node, cpu);
196 #ifndef set_numa_node
203 #ifndef set_cpu_numa_node
222 #ifdef CONFIG_HAVE_MEMORYLESS_NODES
240 static inline int numa_mem_id(
void)
249 return per_cpu(_numa_mem_, cpu);
253 #ifndef set_cpu_numa_mem
264 static inline int numa_mem_id(
void)
279 #ifndef topology_physical_package_id
280 #define topology_physical_package_id(cpu) ((void)(cpu), -1)
282 #ifndef topology_core_id
283 #define topology_core_id(cpu) ((void)(cpu), 0)
285 #ifndef topology_thread_cpumask
286 #define topology_thread_cpumask(cpu) cpumask_of(cpu)
288 #ifndef topology_core_cpumask
289 #define topology_core_cpumask(cpu) cpumask_of(cpu)