Unverified Commit 91ff8f4b authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!11956 Fix CVE-2024-44958 6.6

Merge Pull Request from: @ci-robot 
 
PR sync from: Zheng Zucheng <zhengzucheng@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/CDICWDQNMXPR6DUL3EHQSRMFM3LSMCDM/ 
Yang Yingliang (2):
  [Backport] sched/smt: Introduce sched_smt_present_inc/dec() helper
  [Backport] sched/smt: Fix unbalance sched_smt_present dec/inc


-- 
2.34.1
 
https://gitee.com/src-openeuler/kernel/issues/IAOXYI 
 
Link:https://gitee.com/openeuler/kernel/pulls/11956

 

Reviewed-by: default avatarZhang Peng <zhangpeng362@huawei.com>
Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents 15b951e7 54986fa7
Loading
Loading
Loading
Loading
+20 −7
Original line number Diff line number Diff line
@@ -9711,6 +9711,22 @@ static int cpuset_cpu_inactive(unsigned int cpu)
	return 0;
}

static inline void sched_smt_present_inc(int cpu)
{
#ifdef CONFIG_SCHED_SMT
	if (cpumask_weight(cpu_smt_mask(cpu)) == 2)
		static_branch_inc_cpuslocked(&sched_smt_present);
#endif
}

static inline void sched_smt_present_dec(int cpu)
{
#ifdef CONFIG_SCHED_SMT
	if (cpumask_weight(cpu_smt_mask(cpu)) == 2)
		static_branch_dec_cpuslocked(&sched_smt_present);
#endif
}

int sched_cpu_activate(unsigned int cpu)
{
	struct rq *rq = cpu_rq(cpu);
@@ -9722,13 +9738,10 @@ int sched_cpu_activate(unsigned int cpu)
	 */
	balance_push_set(cpu, false);

#ifdef CONFIG_SCHED_SMT
	/*
	 * When going up, increment the number of cores with SMT present.
	 */
	if (cpumask_weight(cpu_smt_mask(cpu)) == 2)
		static_branch_inc_cpuslocked(&sched_smt_present);
#endif
	sched_smt_present_inc(cpu);
	set_cpu_active(cpu, true);
#ifdef CONFIG_QOS_SCHED_SMART_GRID
	tg_update_affinity_domains(cpu, 1);
@@ -9800,13 +9813,12 @@ int sched_cpu_deactivate(unsigned int cpu)
	}
	rq_unlock_irqrestore(rq, &rf);

#ifdef CONFIG_SCHED_SMT
	/*
	 * When going down, decrement the number of cores with SMT present.
	 */
	if (cpumask_weight(cpu_smt_mask(cpu)) == 2)
		static_branch_dec_cpuslocked(&sched_smt_present);
	sched_smt_present_dec(cpu);

#ifdef CONFIG_SCHED_SMT
	sched_core_cpu_deactivate(cpu);
#endif

@@ -9816,6 +9828,7 @@ int sched_cpu_deactivate(unsigned int cpu)
	sched_update_numa(cpu, false);
	ret = cpuset_cpu_inactive(cpu);
	if (ret) {
		sched_smt_present_inc(cpu);
		balance_push_set(cpu, false);
		set_cpu_active(cpu, true);
		sched_update_numa(cpu, true);