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

!12028 Fix CVE-2024-44958 for olk-5.10

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

Zheng Zucheng (1):
  sched: Revert 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/12028

 

Reviewed-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parents 789262d4 3362216f
Loading
Loading
Loading
Loading
+20 −11
Original line number Diff line number Diff line
@@ -8041,18 +8041,31 @@ 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);
	struct rq_flags rf;

#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);
@@ -8096,13 +8109,12 @@ int sched_cpu_deactivate(unsigned int cpu)
	 */
	synchronize_rcu();

#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

@@ -8111,10 +8123,7 @@ int sched_cpu_deactivate(unsigned int cpu)

	ret = cpuset_cpu_inactive(cpu);
	if (ret) {
#ifdef CONFIG_SCHED_SMT
		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);
		return ret;
	}