Commit 5eab3ce0 authored by zhangwei123171's avatar zhangwei123171
Browse files

sched/fair: fix qos_idle_h_nr_running in enqueue/dequeue

jingdong inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7X9JY



-----------------------------------------------------

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.

Fixes: 57b5487b ("sched/fair: Start tracking qos_offline tasks count in cfs_rq")
Signed-off-by: default avatarzhangwei123171 <zhangwei123171@jd.com>
Reviewed-by: default avatarzhaoxiaoqiang11 <zhaoxiaoqiang11@jd.com>
parent 369da114
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
@@ -5847,12 +5847,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.
@@ -5974,12 +5979,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) {