mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] sched/fair: Fix cfs_rq_is_decayed() on !SMP
@ 2023-09-13 13:20 chengming.zhou
  2023-09-15 12:26 ` [tip: sched/core] " tip-bot2 for Chengming Zhou
  0 siblings, 1 reply; 5+ messages in thread
From: chengming.zhou @ 2023-09-13 13:20 UTC (permalink / raw)
  To: mingo, peterz
  Cc: linux-kernel, chengming.zhou, Chengming Zhou, Leo Yu-Chi Liang,
	Vincent Guittot

From: Chengming Zhou <zhouchengming@bytedance.com>

We don't need to maintain per-queue leaf_cfs_rq_list on !SMP, since
it's used for cfs_rq load tracking & balance on SMP.

But sched debug interface use it to print per-cfs_rq stats, which
maybe better to change to use walk_tg_tree_from() instead.

This patch just fix the !SMP version cfs_rq_is_decayed(), so the
per-queue leaf_cfs_rq_list is also maintained correctly on !SMP,
to fix the warning in assert_list_leaf_cfs_rq().

Fixes: 0a00a354644e ("sched/fair: Delete useless condition in tg_unthrottle_up()")
Reported-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Closes: https://lore.kernel.org/all/ZN87UsqkWcFLDxea@swlinux02/
Tested-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Chengming Zhou <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 8dbff6e7ad4f..845d7729320e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4878,7 +4878,7 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq)
 
 static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq)
 {
-	return true;
+	return !(cfs_rq->nr_running);
 }
 
 #define UPDATE_TG	0x0
-- 
2.40.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip: sched/core] sched/fair: Fix cfs_rq_is_decayed() on !SMP
  2023-09-13 13:20 [PATCH v2] sched/fair: Fix cfs_rq_is_decayed() on !SMP chengming.zhou
@ 2023-09-15 12:26 ` tip-bot2 for Chengming Zhou
  0 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Chengming Zhou @ 2023-09-15 12:26 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Leo Yu-Chi Liang, Chengming Zhou, Ingo Molnar, Vincent Guittot,
	x86, linux-kernel

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     c0490bc9bb62d9376f3dd4ec28e03ca0fef97152
Gitweb:        https://git.kernel.org/tip/c0490bc9bb62d9376f3dd4ec28e03ca0fef97152
Author:        Chengming Zhou <zhouchengming@bytedance.com>
AuthorDate:    Wed, 13 Sep 2023 13:20:31 
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 15 Sep 2023 14:24:00 +02:00

sched/fair: Fix cfs_rq_is_decayed() on !SMP

We don't need to maintain per-queue leaf_cfs_rq_list on !SMP, since
it's used for cfs_rq load tracking & balancing on SMP.

But sched debug interface uses it to print per-cfs_rq stats.

This patch fixes the !SMP version of cfs_rq_is_decayed(), so the
per-queue leaf_cfs_rq_list is also maintained correctly on !SMP,
to fix the warning in assert_list_leaf_cfs_rq().

Fixes: 0a00a354644e ("sched/fair: Delete useless condition in tg_unthrottle_up()")
Reported-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Closes: https://lore.kernel.org/all/ZN87UsqkWcFLDxea@swlinux02/
Link: https://lore.kernel.org/r/20230913132031.2242151-1-chengming.zhou@linux.dev
---
 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 41cfd61..c893721 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4866,7 +4866,7 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq)
 
 static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq)
 {
-	return true;
+	return !cfs_rq->nr_running;
 }
 
 #define UPDATE_TG	0x0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] sched/fair: Fix cfs_rq_is_decayed() on !SMP
  2023-08-18 13:21 ` [PATCH v2] sched/fair: Fix cfs_rq_is_decayed() on !SMP chengming.zhou
  2023-08-21  1:29   ` Leo Liang
@ 2023-08-21 11:59   ` Vincent Guittot
  1 sibling, 0 replies; 5+ messages in thread
From: Vincent Guittot @ 2023-08-21 11:59 UTC (permalink / raw)
  To: chengming.zhou
  Cc: mingo, peterz, ycliang, juri.lelli, dietmar.eggemann, rostedt,
	bsegall, mgorman, bristot, vschneid, zhouchengming, linux-kernel

On Fri, 18 Aug 2023 at 15:22, <chengming.zhou@linux.dev> wrote:
>
> From: Chengming Zhou <zhouchengming@bytedance.com>
>
> We don't need to maintain per-queue leaf_cfs_rq_list on !SMP, since
> it's used for cfs_rq load tracking & balance on SMP.
>
> But sched debug interface use it to print per-cfs_rq stats, which
> maybe better to change to use walk_tg_tree_from() instead.
>
> This patch just fix the !SMP version cfs_rq_is_decayed(), so the
> per-queue leaf_cfs_rq_list is also maintained correctly on !SMP,
> to fix the warning in assert_list_leaf_cfs_rq().
>
> Fixes: 0a00a354644e ("sched/fair: Delete useless condition in tg_unthrottle_up()")
> Reported-by: Leo Liang <ycliang@andestech.com>
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>

Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>

> ---
>  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 a80a73909dc2..05e004515fde 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4654,7 +4654,7 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq)
>
>  static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq)
>  {
> -       return true;
> +       return !(cfs_rq->nr_running);
>  }
>
>  #define UPDATE_TG      0x0
> --
> 2.41.0
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] sched/fair: Fix cfs_rq_is_decayed() on !SMP
  2023-08-18 13:21 ` [PATCH v2] sched/fair: Fix cfs_rq_is_decayed() on !SMP chengming.zhou
@ 2023-08-21  1:29   ` Leo Liang
  2023-08-21 11:59   ` Vincent Guittot
  1 sibling, 0 replies; 5+ messages in thread
From: Leo Liang @ 2023-08-21  1:29 UTC (permalink / raw)
  To: chengming.zhou
  Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, bristot, vschneid, zhouchengming,
	linux-kernel

Hi Chengming,

On Fri, Aug 18, 2023 at 09:21:48PM +0800, chengming.zhou@linux.dev wrote:
> From: Chengming Zhou <zhouchengming@bytedance.com>
> 
> We don't need to maintain per-queue leaf_cfs_rq_list on !SMP, since
> it's used for cfs_rq load tracking & balance on SMP.
> 
> But sched debug interface use it to print per-cfs_rq stats, which
> maybe better to change to use walk_tg_tree_from() instead.
> 
> This patch just fix the !SMP version cfs_rq_is_decayed(), so the
> per-queue leaf_cfs_rq_list is also maintained correctly on !SMP,
> to fix the warning in assert_list_leaf_cfs_rq().
> 
> Fixes: 0a00a354644e ("sched/fair: Delete useless condition in tg_unthrottle_up()")
> Reported-by: Leo Liang <ycliang@andestech.com>
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
> ---
>  kernel/sched/fair.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks for the quick patch!

Tested-by: Leo Yu-Chi Liang <ycliang@andestech.com>

Best regards,
Leo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] sched/fair: Fix cfs_rq_is_decayed() on !SMP
  2023-08-18  9:35 PROBLEM: LTP cfs_bandwidth01 test bumped into SCHED_WARN_ON after de-selecting CONFIG_SMP Leo Liang
@ 2023-08-18 13:21 ` chengming.zhou
  2023-08-21  1:29   ` Leo Liang
  2023-08-21 11:59   ` Vincent Guittot
  0 siblings, 2 replies; 5+ messages in thread
From: chengming.zhou @ 2023-08-18 13:21 UTC (permalink / raw)
  To: mingo, peterz, ycliang
  Cc: juri.lelli, vincent.guittot, dietmar.eggemann, rostedt, bsegall,
	mgorman, bristot, vschneid, zhouchengming, linux-kernel

From: Chengming Zhou <zhouchengming@bytedance.com>

We don't need to maintain per-queue leaf_cfs_rq_list on !SMP, since
it's used for cfs_rq load tracking & balance on SMP.

But sched debug interface use it to print per-cfs_rq stats, which
maybe better to change to use walk_tg_tree_from() instead.

This patch just fix the !SMP version cfs_rq_is_decayed(), so the
per-queue leaf_cfs_rq_list is also maintained correctly on !SMP,
to fix the warning in assert_list_leaf_cfs_rq().

Fixes: 0a00a354644e ("sched/fair: Delete useless condition in tg_unthrottle_up()")
Reported-by: Leo Liang <ycliang@andestech.com>
Signed-off-by: Chengming Zhou <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 a80a73909dc2..05e004515fde 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4654,7 +4654,7 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq)
 
 static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq)
 {
-	return true;
+	return !(cfs_rq->nr_running);
 }
 
 #define UPDATE_TG	0x0
-- 
2.41.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-15 12:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-13 13:20 [PATCH v2] sched/fair: Fix cfs_rq_is_decayed() on !SMP chengming.zhou
2023-09-15 12:26 ` [tip: sched/core] " tip-bot2 for Chengming Zhou
  -- strict thread matches above, loose matches on Subject: below --
2023-08-18  9:35 PROBLEM: LTP cfs_bandwidth01 test bumped into SCHED_WARN_ON after de-selecting CONFIG_SMP Leo Liang
2023-08-18 13:21 ` [PATCH v2] sched/fair: Fix cfs_rq_is_decayed() on !SMP chengming.zhou
2023-08-21  1:29   ` Leo Liang
2023-08-21 11:59   ` Vincent Guittot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®