All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Move calculate of avg_load to a better location
@ 2022-04-06  9:57 zgpeng
  2022-04-06 15:21 ` Vincent Guittot
  2022-04-22 10:27 ` [tip: sched/core] " tip-bot2 for zgpeng
  0 siblings, 2 replies; 3+ messages in thread
From: zgpeng @ 2022-04-06  9:57 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, bristot, linux-kernel

In calculate_imbalance function, when the value of local->avg_load is
greater than or equal to busiest->avg_load, the calculated sds->avg_load is
not used. So this calculation can be placed in a more appropriate position.

Signed-off-by: zgpeng <zgpeng@tencent.com>
Reviewed-by: Samuel Liao <samuelliao@tencent.com>
---
 kernel/sched/fair.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d4bd299..601f8bd 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9460,8 +9460,6 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
 		local->avg_load = (local->group_load * SCHED_CAPACITY_SCALE) /
 				  local->group_capacity;
 
-		sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) /
-				sds->total_capacity;
 		/*
 		 * If the local group is more loaded than the selected
 		 * busiest group don't try to pull any tasks.
@@ -9470,6 +9468,9 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
 			env->imbalance = 0;
 			return;
 		}
+
+		sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) /
+				sds->total_capacity;
 	}
 
 	/*
-- 
2.9.5


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

* Re: [PATCH] sched/fair: Move calculate of avg_load to a better location
  2022-04-06  9:57 [PATCH] sched/fair: Move calculate of avg_load to a better location zgpeng
@ 2022-04-06 15:21 ` Vincent Guittot
  2022-04-22 10:27 ` [tip: sched/core] " tip-bot2 for zgpeng
  1 sibling, 0 replies; 3+ messages in thread
From: Vincent Guittot @ 2022-04-06 15:21 UTC (permalink / raw)
  To: zgpeng
  Cc: mingo, peterz, juri.lelli, dietmar.eggemann, rostedt, bsegall,
	mgorman, bristot, linux-kernel

On Wed, 6 Apr 2022 at 11:57, zgpeng <zgpeng.linux@gmail.com> wrote:
>
> In calculate_imbalance function, when the value of local->avg_load is
> greater than or equal to busiest->avg_load, the calculated sds->avg_load is
> not used. So this calculation can be placed in a more appropriate position.
>
> Signed-off-by: zgpeng <zgpeng@tencent.com>
> Reviewed-by: Samuel Liao <samuelliao@tencent.com>

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

> ---
>  kernel/sched/fair.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index d4bd299..601f8bd 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -9460,8 +9460,6 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
>                 local->avg_load = (local->group_load * SCHED_CAPACITY_SCALE) /
>                                   local->group_capacity;
>
> -               sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) /
> -                               sds->total_capacity;
>                 /*
>                  * If the local group is more loaded than the selected
>                  * busiest group don't try to pull any tasks.
> @@ -9470,6 +9468,9 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
>                         env->imbalance = 0;
>                         return;
>                 }
> +
> +               sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) /
> +                               sds->total_capacity;
>         }
>
>         /*
> --
> 2.9.5
>

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

* [tip: sched/core] sched/fair: Move calculate of avg_load to a better location
  2022-04-06  9:57 [PATCH] sched/fair: Move calculate of avg_load to a better location zgpeng
  2022-04-06 15:21 ` Vincent Guittot
@ 2022-04-22 10:27 ` tip-bot2 for zgpeng
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for zgpeng @ 2022-04-22 10:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: zgpeng, Peter Zijlstra (Intel),
	Samuel Liao, Vincent Guittot, x86, linux-kernel

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

Commit-ID:     06354900787f25bf5be3c07a68e3cdbc5bf0fa69
Gitweb:        https://git.kernel.org/tip/06354900787f25bf5be3c07a68e3cdbc5bf0fa69
Author:        zgpeng <zgpeng.linux@gmail.com>
AuthorDate:    Wed, 06 Apr 2022 17:57:05 +08:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 22 Apr 2022 12:14:07 +02:00

sched/fair: Move calculate of avg_load to a better location

In calculate_imbalance function, when the value of local->avg_load is
greater than or equal to busiest->avg_load, the calculated sds->avg_load is
not used. So this calculation can be placed in a more appropriate position.

Signed-off-by: zgpeng <zgpeng@tencent.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Samuel Liao <samuelliao@tencent.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/1649239025-10010-1-git-send-email-zgpeng@tencent.com
---
 kernel/sched/fair.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d4bd299..601f8bd 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9460,8 +9460,6 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
 		local->avg_load = (local->group_load * SCHED_CAPACITY_SCALE) /
 				  local->group_capacity;
 
-		sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) /
-				sds->total_capacity;
 		/*
 		 * If the local group is more loaded than the selected
 		 * busiest group don't try to pull any tasks.
@@ -9470,6 +9468,9 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
 			env->imbalance = 0;
 			return;
 		}
+
+		sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) /
+				sds->total_capacity;
 	}
 
 	/*

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

end of thread, other threads:[~2022-04-22 10:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06  9:57 [PATCH] sched/fair: Move calculate of avg_load to a better location zgpeng
2022-04-06 15:21 ` Vincent Guittot
2022-04-22 10:27 ` [tip: sched/core] " tip-bot2 for zgpeng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.