History

sched: Simplify ifdeffery around cpu_smt_mask

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.

Shrikanth Hegde committed 6 months ago

Commit 5bc6ab21 parent 815c5cb8 files · +5 −63Browse files

Showing the changes to kernel/workqueue.c (1 of 8 files). Show all

Unified · Split

kernel/workqueue.c+0−4
@@ -8187,11 +8187,7 @@ static bool __init cpus_dont_share(int cpu0, int cpu1) · 8186 unmodified lines
8187 8187
8188static bool __init cpus_share_smt(int cpu0, int cpu1)8188static bool __init cpus_share_smt(int cpu0, int cpu1)
8189{8189{
8190#ifdef CONFIG_SCHED_SMT
8191 return cpumask_test_cpu(cpu0, cpu_smt_mask(cpu1));8190 return cpumask_test_cpu(cpu0, cpu_smt_mask(cpu1));
8192#else
8193 return false;
8194#endif
8195}8191}
8196 8192
8197static bool __init cpus_share_numa(int cpu0, int cpu1)8193static bool __init cpus_share_numa(int cpu0, int cpu1)