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

!14413 sched/dynamic_affinity: Calculate cpu capacity in real time when...

!14413  sched/dynamic_affinity: Calculate cpu capacity in real time when realtime tasks are running on this cpu

Merge Pull Request from: @ci-robot 
 
PR sync from: He Yujie <coka.heyujie@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/ZE25C6EIF4ITARE7W276ALSTOINVXCIJ/ 
 
https://gitee.com/src-openeuler/kernel/issues/IBEBAG 
 
Link:https://gitee.com/openeuler/kernel/pulls/14413

 

Reviewed-by: default avatarYuan Can <yuancan@huawei.com>
Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
parents 4c116feb 6fd03baa
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -7226,6 +7226,19 @@ static inline bool prefer_cpus_valid(struct task_struct *p)
	       cpumask_subset(prefer_cpus, &p->cpus_allowed);
}

static unsigned long scale_rt_capacity(struct sched_domain *sd, int cpu);

static inline unsigned long calc_cpu_capacity(int cpu)
{
	unsigned long capacity;

	capacity = scale_rt_capacity(NULL, cpu);
	if (!capacity)
		capacity = 1;

	return capacity;
}

/*
 * set_task_select_cpus: select the cpu range for task
 * @p: the task whose available cpu range will to set
@@ -7288,6 +7301,10 @@ static void set_task_select_cpus(struct task_struct *p, int *idlest_cpu,
		}

		util_avg_sum += tg->se[cpu]->avg.util_avg;

		if (cpu_rq(cpu)->rt.rt_nr_running)
			tg_capacity += calc_cpu_capacity(cpu);
		else
			tg_capacity += capacity_of(cpu);
	}
	rcu_read_unlock();