* [PATCH v2 1/2] sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq
@ 2022-04-08 11:53 Chengming Zhou
2022-04-08 11:53 ` [PATCH v2 2/2] sched/fair: Delete useless condition in tg_unthrottle_up() Chengming Zhou
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Chengming Zhou @ 2022-04-08 11:53 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, bristot
Cc: linux-kernel, duanxiongchun, songmuchun, Chengming Zhou
Since commit 23127296889f ("sched/fair: Update scale invariance of PELT")
change to use rq_clock_pelt() instead of rq_clock_task(), we should also
use rq_clock_pelt() for throttled_clock_task_time and throttled_clock_task
accounting to get correct cfs_rq_clock_pelt() of throttled cfs_rq. And
rename throttled_clock_task(_time) to be clock_pelt rather than clock_task.
Fixes: 23127296889f ("sched/fair: Update scale invariance of PELT")
Reviewed-by: Ben Segall <bsegall@google.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
v2:
- rename throttled_clock_task(_time) to be clock_pelt rather than
clock_task, thanks Ben.
- add Reviewed-by tags.
---
kernel/sched/fair.c | 8 ++++----
kernel/sched/pelt.h | 4 ++--
kernel/sched/sched.h | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d4bd299d67ab..dc73c3b500a5 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4846,8 +4846,8 @@ static int tg_unthrottle_up(struct task_group *tg, void *data)
cfs_rq->throttle_count--;
if (!cfs_rq->throttle_count) {
- cfs_rq->throttled_clock_task_time += rq_clock_task(rq) -
- cfs_rq->throttled_clock_task;
+ cfs_rq->throttled_clock_pelt_time += rq_clock_pelt(rq) -
+ cfs_rq->throttled_clock_pelt;
/* Add cfs_rq with load or one or more already running entities to the list */
if (!cfs_rq_is_decayed(cfs_rq) || cfs_rq->nr_running)
@@ -4864,7 +4864,7 @@ static int tg_throttle_down(struct task_group *tg, void *data)
/* group is entering throttled state, stop time */
if (!cfs_rq->throttle_count) {
- cfs_rq->throttled_clock_task = rq_clock_task(rq);
+ cfs_rq->throttled_clock_pelt = rq_clock_pelt(rq);
list_del_leaf_cfs_rq(cfs_rq);
}
cfs_rq->throttle_count++;
@@ -5308,7 +5308,7 @@ static void sync_throttle(struct task_group *tg, int cpu)
pcfs_rq = tg->parent->cfs_rq[cpu];
cfs_rq->throttle_count = pcfs_rq->throttle_count;
- cfs_rq->throttled_clock_task = rq_clock_task(cpu_rq(cpu));
+ cfs_rq->throttled_clock_pelt = rq_clock_pelt(cpu_rq(cpu));
}
/* conditionally throttle active cfs_rq's from put_prev_entity() */
diff --git a/kernel/sched/pelt.h b/kernel/sched/pelt.h
index c336f5f481bc..4ff2ed4f8fa1 100644
--- a/kernel/sched/pelt.h
+++ b/kernel/sched/pelt.h
@@ -145,9 +145,9 @@ static inline u64 rq_clock_pelt(struct rq *rq)
static inline u64 cfs_rq_clock_pelt(struct cfs_rq *cfs_rq)
{
if (unlikely(cfs_rq->throttle_count))
- return cfs_rq->throttled_clock_task - cfs_rq->throttled_clock_task_time;
+ return cfs_rq->throttled_clock_pelt - cfs_rq->throttled_clock_pelt_time;
- return rq_clock_pelt(rq_of(cfs_rq)) - cfs_rq->throttled_clock_task_time;
+ return rq_clock_pelt(rq_of(cfs_rq)) - cfs_rq->throttled_clock_pelt_time;
}
#else
static inline u64 cfs_rq_clock_pelt(struct cfs_rq *cfs_rq)
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 58263f90c559..762be73972bd 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -603,8 +603,8 @@ struct cfs_rq {
s64 runtime_remaining;
u64 throttled_clock;
- u64 throttled_clock_task;
- u64 throttled_clock_task_time;
+ u64 throttled_clock_pelt;
+ u64 throttled_clock_pelt_time;
int throttled;
int throttle_count;
struct list_head throttled_list;
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] sched/fair: Delete useless condition in tg_unthrottle_up()
2022-04-08 11:53 [PATCH v2 1/2] sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq Chengming Zhou
@ 2022-04-08 11:53 ` Chengming Zhou
2022-04-22 10:27 ` [tip: sched/core] " tip-bot2 for Chengming Zhou
2022-04-08 12:28 ` [PATCH v2 1/2] sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq Peter Zijlstra
2022-04-22 10:27 ` [tip: sched/core] " tip-bot2 for Chengming Zhou
2 siblings, 1 reply; 5+ messages in thread
From: Chengming Zhou @ 2022-04-08 11:53 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, bristot
Cc: linux-kernel, duanxiongchun, songmuchun, Chengming Zhou
We have tested cfs_rq->load.weight in cfs_rq_is_decayed(),
the first condition "!cfs_rq_is_decayed(cfs_rq)" is enough
to cover the second condition "cfs_rq->nr_running".
Reviewed-by: Ben Segall <bsegall@google.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
v2:
- improve the commit message.
- add Reviewed-by tags.
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index dc73c3b500a5..64186ea245c6 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4850,7 +4850,7 @@ static int tg_unthrottle_up(struct task_group *tg, void *data)
cfs_rq->throttled_clock_pelt;
/* Add cfs_rq with load or one or more already running entities to the list */
- if (!cfs_rq_is_decayed(cfs_rq) || cfs_rq->nr_running)
+ if (!cfs_rq_is_decayed(cfs_rq))
list_add_leaf_cfs_rq(cfs_rq);
}
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq
2022-04-08 11:53 [PATCH v2 1/2] sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq Chengming Zhou
2022-04-08 11:53 ` [PATCH v2 2/2] sched/fair: Delete useless condition in tg_unthrottle_up() Chengming Zhou
@ 2022-04-08 12:28 ` Peter Zijlstra
2022-04-22 10:27 ` [tip: sched/core] " tip-bot2 for Chengming Zhou
2 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2022-04-08 12:28 UTC (permalink / raw)
To: Chengming Zhou
Cc: mingo, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt,
bsegall, mgorman, bristot, linux-kernel, duanxiongchun,
songmuchun
On Fri, Apr 08, 2022 at 07:53:08PM +0800, Chengming Zhou wrote:
> Since commit 23127296889f ("sched/fair: Update scale invariance of PELT")
> change to use rq_clock_pelt() instead of rq_clock_task(), we should also
> use rq_clock_pelt() for throttled_clock_task_time and throttled_clock_task
> accounting to get correct cfs_rq_clock_pelt() of throttled cfs_rq. And
> rename throttled_clock_task(_time) to be clock_pelt rather than clock_task.
>
> Fixes: 23127296889f ("sched/fair: Update scale invariance of PELT")
> Reviewed-by: Ben Segall <bsegall@google.com>
> Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Thanks! (for all 3 patches)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip: sched/core] sched/fair: Delete useless condition in tg_unthrottle_up()
2022-04-08 11:53 ` [PATCH v2 2/2] sched/fair: Delete useless condition in tg_unthrottle_up() Chengming Zhou
@ 2022-04-22 10:27 ` tip-bot2 for Chengming Zhou
0 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Chengming Zhou @ 2022-04-22 10:27 UTC (permalink / raw)
To: linux-tip-commits
Cc: Chengming Zhou, Peter Zijlstra (Intel),
Ben Segall, Vincent Guittot, x86, linux-kernel
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 0a00a354644ee1800d31c47cf5927b9b50272fac
Gitweb: https://git.kernel.org/tip/0a00a354644ee1800d31c47cf5927b9b50272fac
Author: Chengming Zhou <zhouchengming@bytedance.com>
AuthorDate: Fri, 08 Apr 2022 19:53:09 +08:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 22 Apr 2022 12:14:07 +02:00
sched/fair: Delete useless condition in tg_unthrottle_up()
We have tested cfs_rq->load.weight in cfs_rq_is_decayed(),
the first condition "!cfs_rq_is_decayed(cfs_rq)" is enough
to cover the second condition "cfs_rq->nr_running".
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Ben Segall <bsegall@google.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20220408115309.81603-2-zhouchengming@bytedance.com
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index f74b340..3eba0dc 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4850,7 +4850,7 @@ static int tg_unthrottle_up(struct task_group *tg, void *data)
cfs_rq->throttled_clock_pelt;
/* Add cfs_rq with load or one or more already running entities to the list */
- if (!cfs_rq_is_decayed(cfs_rq) || cfs_rq->nr_running)
+ if (!cfs_rq_is_decayed(cfs_rq))
list_add_leaf_cfs_rq(cfs_rq);
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [tip: sched/core] sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq
2022-04-08 11:53 [PATCH v2 1/2] sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq Chengming Zhou
2022-04-08 11:53 ` [PATCH v2 2/2] sched/fair: Delete useless condition in tg_unthrottle_up() Chengming Zhou
2022-04-08 12:28 ` [PATCH v2 1/2] sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq Peter Zijlstra
@ 2022-04-22 10:27 ` tip-bot2 for Chengming Zhou
2 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Chengming Zhou @ 2022-04-22 10:27 UTC (permalink / raw)
To: linux-tip-commits
Cc: Chengming Zhou, Peter Zijlstra (Intel),
Ben Segall, Vincent Guittot, x86, linux-kernel
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 64eaf50731ac0a8c76ce2fedd50ef6652aabc5ff
Gitweb: https://git.kernel.org/tip/64eaf50731ac0a8c76ce2fedd50ef6652aabc5ff
Author: Chengming Zhou <zhouchengming@bytedance.com>
AuthorDate: Fri, 08 Apr 2022 19:53:08 +08:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 22 Apr 2022 12:14:07 +02:00
sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq
Since commit 23127296889f ("sched/fair: Update scale invariance of PELT")
change to use rq_clock_pelt() instead of rq_clock_task(), we should also
use rq_clock_pelt() for throttled_clock_task_time and throttled_clock_task
accounting to get correct cfs_rq_clock_pelt() of throttled cfs_rq. And
rename throttled_clock_task(_time) to be clock_pelt rather than clock_task.
Fixes: 23127296889f ("sched/fair: Update scale invariance of PELT")
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Ben Segall <bsegall@google.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20220408115309.81603-1-zhouchengming@bytedance.com
---
kernel/sched/fair.c | 8 ++++----
kernel/sched/pelt.h | 4 ++--
kernel/sched/sched.h | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 601f8bd..f74b340 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4846,8 +4846,8 @@ static int tg_unthrottle_up(struct task_group *tg, void *data)
cfs_rq->throttle_count--;
if (!cfs_rq->throttle_count) {
- cfs_rq->throttled_clock_task_time += rq_clock_task(rq) -
- cfs_rq->throttled_clock_task;
+ cfs_rq->throttled_clock_pelt_time += rq_clock_pelt(rq) -
+ cfs_rq->throttled_clock_pelt;
/* Add cfs_rq with load or one or more already running entities to the list */
if (!cfs_rq_is_decayed(cfs_rq) || cfs_rq->nr_running)
@@ -4864,7 +4864,7 @@ static int tg_throttle_down(struct task_group *tg, void *data)
/* group is entering throttled state, stop time */
if (!cfs_rq->throttle_count) {
- cfs_rq->throttled_clock_task = rq_clock_task(rq);
+ cfs_rq->throttled_clock_pelt = rq_clock_pelt(rq);
list_del_leaf_cfs_rq(cfs_rq);
}
cfs_rq->throttle_count++;
@@ -5308,7 +5308,7 @@ static void sync_throttle(struct task_group *tg, int cpu)
pcfs_rq = tg->parent->cfs_rq[cpu];
cfs_rq->throttle_count = pcfs_rq->throttle_count;
- cfs_rq->throttled_clock_task = rq_clock_task(cpu_rq(cpu));
+ cfs_rq->throttled_clock_pelt = rq_clock_pelt(cpu_rq(cpu));
}
/* conditionally throttle active cfs_rq's from put_prev_entity() */
diff --git a/kernel/sched/pelt.h b/kernel/sched/pelt.h
index c336f5f..4ff2ed4 100644
--- a/kernel/sched/pelt.h
+++ b/kernel/sched/pelt.h
@@ -145,9 +145,9 @@ static inline u64 rq_clock_pelt(struct rq *rq)
static inline u64 cfs_rq_clock_pelt(struct cfs_rq *cfs_rq)
{
if (unlikely(cfs_rq->throttle_count))
- return cfs_rq->throttled_clock_task - cfs_rq->throttled_clock_task_time;
+ return cfs_rq->throttled_clock_pelt - cfs_rq->throttled_clock_pelt_time;
- return rq_clock_pelt(rq_of(cfs_rq)) - cfs_rq->throttled_clock_task_time;
+ return rq_clock_pelt(rq_of(cfs_rq)) - cfs_rq->throttled_clock_pelt_time;
}
#else
static inline u64 cfs_rq_clock_pelt(struct cfs_rq *cfs_rq)
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 58263f9..762be73 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -603,8 +603,8 @@ struct cfs_rq {
s64 runtime_remaining;
u64 throttled_clock;
- u64 throttled_clock_task;
- u64 throttled_clock_task_time;
+ u64 throttled_clock_pelt;
+ u64 throttled_clock_pelt_time;
int throttled;
int throttle_count;
struct list_head throttled_list;
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-22 10:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-08 11:53 [PATCH v2 1/2] sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq Chengming Zhou
2022-04-08 11:53 ` [PATCH v2 2/2] sched/fair: Delete useless condition in tg_unthrottle_up() Chengming Zhou
2022-04-22 10:27 ` [tip: sched/core] " tip-bot2 for Chengming Zhou
2022-04-08 12:28 ` [PATCH v2 1/2] sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq Peter Zijlstra
2022-04-22 10:27 ` [tip: sched/core] " tip-bot2 for Chengming Zhou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).