Now, that cpu_smt_mask is defined as cpumask_of(cpu) for CONFIG_SCHED_SMT=n, it is possible to get rid of the ifdeffery. Effectively, - This makes sched_smt_present is defined always - cpumask_weight(cpumask_of(cpu)) == 1. So sched_smt_present_inc/dec will never enable the sched_smt_present. Which is expected. - Paths that were compile-time eliminated become runtime guarded using static keys. - Defines set_idle_cores, test_idle_cores, etc which could likely benefit the CONFIG_SCHED_SMT=n systems to use the same optimizations within the LLC at wakeups. - This will expose sched_smt_present symbol for CONFIG_SCHED_SMT=n. Likely not a concern. - There is a bloat of code CONFIG_SCHED_SMT=n. (NR_CPUS=2048) add/remove: 24/18 grow/shrink: 26/28 up/down: 6396/-3188 (3208) Total: Before=30629880, After=30633088, chg +0.01% - No code bloat for CONFIG_SCHED_SMT=y, which is expected. - Add comments around stop_core_cpuslocked on why ifdefs are not removed. - This leaves the remaining uses of CONFIG_SCHED_SMT mainly for topology building bits which has a policy based decision.
Showing the changes to kernel/workqueue.c (1 of 8 files). Show all
Unified · Split
| @@ -8187,11 +8187,7 @@ static bool __init cpus_dont_share(int cpu0, int cpu1) · 8186 unmodified lines | ||
| 8187 | 8187 | |
| 8188 | 8188 | static bool __init cpus_share_smt(int cpu0, int cpu1) |
| 8189 | 8189 | { |
| 8190 | −#ifdef CONFIG_SCHED_SMT | |
| 8191 | 8190 | return cpumask_test_cpu(cpu0, cpu_smt_mask(cpu1)); |
| 8192 | −#else | |
| 8193 | − return false; | |
| 8194 | −#endif | |
| 8195 | 8191 | } |
| 8196 | 8192 | |
| 8197 | 8193 | static bool __init cpus_share_numa(int cpu0, int cpu1) |