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

!1972 sched/fair: fix qos_idle_h_nr_running in enqueue/dequeue

Merge Pull Request from: @zhangwei123171 
 

When the container switches from offline mode to online mode, or from offline mode to online mode, qos_idle_h_nr_running will count errors.

If task se is counted according to the online task when it enters rq, then it must also be counted according to
the online task when it leaves the rq. 
 
Link:https://gitee.com/openeuler/kernel/pulls/1972

 

Reviewed-by: default avatarzhao xiaoqiang <zhaoxiaoqiang11@jd.com>
Reviewed-by: default avatarZucheng Zheng <zhengzucheng@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 3523cb19 5eab3ce0
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -516,7 +516,11 @@ struct sched_entity {
	struct sched_avg		avg;
#endif

#ifdef CONFIG_QOS_SCHED_SMT_EXPELLER
	KABI_USE(1, long qos_idle)
#else
	KABI_RESERVE(1)
#endif
	KABI_RESERVE(2)
	KABI_RESERVE(3)
	KABI_RESERVE(4)
+15 −6
Original line number Diff line number Diff line
@@ -5860,12 +5860,17 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
	struct cfs_rq *cfs_rq;
	struct sched_entity *se = &p->se;
	int idle_h_nr_running = task_has_idle_policy(p);
#ifdef CONFIG_QOS_SCHED_SMT_EXPELLER
	int qos_idle_h_nr_running = task_has_qos_idle_policy(p);
#endif

	int task_new = !(flags & ENQUEUE_WAKEUP);
	unsigned int prev_nr = rq->cfs.h_nr_running;

#ifdef CONFIG_QOS_SCHED_SMT_EXPELLER
	int qos_idle_h_nr_running;

	se->qos_idle = task_has_qos_idle_policy(p);
	qos_idle_h_nr_running = se->qos_idle ? 1 : 0;
#endif

	/*
	 * The code below (indirectly) updates schedutil which looks at
	 * the cfs_rq utilization to select a frequency.
@@ -5987,12 +5992,16 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)
	struct sched_entity *se = &p->se;
	int task_sleep = flags & DEQUEUE_SLEEP;
	int idle_h_nr_running = task_has_idle_policy(p);
#ifdef CONFIG_QOS_SCHED_SMT_EXPELLER
	int qos_idle_h_nr_running = task_has_qos_idle_policy(p);
#endif

	unsigned int prev_nr = rq->cfs.h_nr_running;
	bool was_sched_idle = sched_idle_rq(rq);

#ifdef CONFIG_QOS_SCHED_SMT_EXPELLER
	int qos_idle_h_nr_running = se->qos_idle ? 1 : 0;

	se->qos_idle = 0;
#endif

	util_est_dequeue(&rq->cfs, p);

	for_each_sched_entity(se) {