[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210609143339.1194238-1-qperret@google.com>
Date: Wed, 9 Jun 2021 14:33:39 +0000
From: Quentin Perret <qperret@...gle.com>
To: mingo@...hat.com, peterz@...radead.org, vincent.guittot@...aro.org,
dietmar.eggemann@....com, qais.yousef@....com, rickyiu@...gle.com,
wvw@...gle.com, patrick.bellasi@...bug.net
Cc: linux-kernel@...r.kernel.org, kernel-team@...roid.com,
Quentin Perret <qperret@...gle.com>
Subject: [PATCH] sched: Fix UCLAMP_FLAG_IDLE setting
The UCLAMP_FLAG_IDLE flag is set on a runqueue when dequeueing the last
active task to maintain the last uclamp.max and prevent blocked util
from suddenly becoming visible.
However, there is an asymmetry in how the flag is set and cleared which
can lead to having the flag set whilst there are active task on the rq.
Specifically, the flag is set in the uclamp_rq_inc() path, which is
called at enqueue time, but cleared in the uclamp_rq_dec_id() which is
called both when dequeueing and task _and_ during cgroup migrations.
Fix this by setting the flag in the uclamp_rq_inc_id() path to ensure
things remain symmetrical.
Reported-by: Rick Yiu <rickyiu@...gle.com>
Signed-off-by: Quentin Perret <qperret@...gle.com>
---
kernel/sched/core.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5226cc26a095..3b213402798e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -980,6 +980,7 @@ static inline void uclamp_idle_reset(struct rq *rq, enum uclamp_id clamp_id,
if (!(rq->uclamp_flags & UCLAMP_FLAG_IDLE))
return;
+ rq->uclamp_flags &= ~UCLAMP_FLAG_IDLE;
WRITE_ONCE(rq->uclamp[clamp_id].value, clamp_value);
}
@@ -1252,10 +1253,6 @@ static inline void uclamp_rq_inc(struct rq *rq, struct task_struct *p)
for_each_clamp_id(clamp_id)
uclamp_rq_inc_id(rq, p, clamp_id);
-
- /* Reset clamp idle holding when there is one RUNNABLE task */
- if (rq->uclamp_flags & UCLAMP_FLAG_IDLE)
- rq->uclamp_flags &= ~UCLAMP_FLAG_IDLE;
}
static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p)
--
2.32.0.272.g935e593368-goog
Powered by blists - more mailing lists