aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r--kernel/sched/core.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 091e089063be..6fedf3a98581 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5738,15 +5738,10 @@ int sched_cpu_activate(unsigned int cpu)
5738 5738
5739#ifdef CONFIG_SCHED_SMT 5739#ifdef CONFIG_SCHED_SMT
5740 /* 5740 /*
5741 * The sched_smt_present static key needs to be evaluated on every 5741 * When going up, increment the number of cores with SMT present.
5742 * hotplug event because at boot time SMT might be disabled when
5743 * the number of booted CPUs is limited.
5744 *
5745 * If then later a sibling gets hotplugged, then the key would stay
5746 * off and SMT scheduling would never be functional.
5747 */ 5742 */
5748 if (cpumask_weight(cpu_smt_mask(cpu)) > 1) 5743 if (cpumask_weight(cpu_smt_mask(cpu)) == 2)
5749 static_branch_enable_cpuslocked(&sched_smt_present); 5744 static_branch_inc_cpuslocked(&sched_smt_present);
5750#endif 5745#endif
5751 set_cpu_active(cpu, true); 5746 set_cpu_active(cpu, true);
5752 5747
@@ -5790,6 +5785,14 @@ int sched_cpu_deactivate(unsigned int cpu)
5790 */ 5785 */
5791 synchronize_rcu_mult(call_rcu, call_rcu_sched); 5786 synchronize_rcu_mult(call_rcu, call_rcu_sched);
5792 5787
5788#ifdef CONFIG_SCHED_SMT
5789 /*
5790 * When going down, decrement the number of cores with SMT present.
5791 */
5792 if (cpumask_weight(cpu_smt_mask(cpu)) == 2)
5793 static_branch_dec_cpuslocked(&sched_smt_present);
5794#endif
5795
5793 if (!sched_smp_initialized) 5796 if (!sched_smp_initialized)
5794 return 0; 5797 return 0;
5795 5798