linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Fix negative imbalance in imbalance calculation
@ 2020-03-26  5:42 Aubrey Li
  2020-03-26 13:30 ` Phil Auld
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Aubrey Li @ 2020-03-26  5:42 UTC (permalink / raw)
  To: vincent.guittot, mingo, peterz, juri.lelli, dietmar.eggemann,
	rostedt, bsegall, mgorman, linux-kernel
  Cc: tim.c.chen, vpillai, joel, Aubrey Li, Aubrey Li, Phil Auld

A negative imbalance value was observed after imbalance calculation,
this happens when the local sched group type is group_fully_busy,
and the average load of local group is greater than the selected
busiest group. Fix this problem by comparing the average load of the
local and busiest group before imbalance calculation formula.

Suggested-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Aubrey Li <aubrey.li@linux.intel.com>
Cc: Phil Auld <pauld@redhat.com>
---
 kernel/sched/fair.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index c1217bf..4a2ba3f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8761,6 +8761,14 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
 
 		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.
+		 */
+		if (local->avg_load >= busiest->avg_load) {
+			env->imbalance = 0;
+			return;
+		}
 	}
 
 	/*
-- 
2.7.4


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

* Re: [PATCH] sched/fair: Fix negative imbalance in imbalance calculation
  2020-03-26  5:42 [PATCH] sched/fair: Fix negative imbalance in imbalance calculation Aubrey Li
@ 2020-03-26 13:30 ` Phil Auld
  2020-03-26 16:03 ` Vincent Guittot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Phil Auld @ 2020-03-26 13:30 UTC (permalink / raw)
  To: Aubrey Li
  Cc: vincent.guittot, mingo, peterz, juri.lelli, dietmar.eggemann,
	rostedt, bsegall, mgorman, linux-kernel, tim.c.chen, vpillai,
	joel, Aubrey Li

On Thu, Mar 26, 2020 at 01:42:29PM +0800 Aubrey Li wrote:
> A negative imbalance value was observed after imbalance calculation,
> this happens when the local sched group type is group_fully_busy,
> and the average load of local group is greater than the selected
> busiest group. Fix this problem by comparing the average load of the
> local and busiest group before imbalance calculation formula.
> 
> Suggested-by: Vincent Guittot <vincent.guittot@linaro.org>
> Signed-off-by: Aubrey Li <aubrey.li@linux.intel.com>
> Cc: Phil Auld <pauld@redhat.com>
> ---
>  kernel/sched/fair.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index c1217bf..4a2ba3f 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8761,6 +8761,14 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
>  
>  		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.
> +		 */
> +		if (local->avg_load >= busiest->avg_load) {
> +			env->imbalance = 0;
> +			return;
> +		}
>  	}
>  
>  	/*
> -- 
> 2.7.4
> 

I like this one better. Thanks!

Reviewed-by: Phil Auld <pauld@redhat.com>

-- 


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

* Re: [PATCH] sched/fair: Fix negative imbalance in imbalance calculation
  2020-03-26  5:42 [PATCH] sched/fair: Fix negative imbalance in imbalance calculation Aubrey Li
  2020-03-26 13:30 ` Phil Auld
@ 2020-03-26 16:03 ` Vincent Guittot
  2020-03-30 10:38   ` Peter Zijlstra
  2020-03-27 11:48 ` Mel Gorman
  2020-04-08 12:20 ` [tip: sched/urgent] " tip-bot2 for Aubrey Li
  3 siblings, 1 reply; 6+ messages in thread
From: Vincent Guittot @ 2020-03-26 16:03 UTC (permalink / raw)
  To: Aubrey Li
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, linux-kernel, Tim Chen,
	Vineeth Pillai, Joel Fernandes, Aubrey Li, Phil Auld

On Thu, 26 Mar 2020 at 06:53, Aubrey Li <aubrey.li@intel.com> wrote:
>
> A negative imbalance value was observed after imbalance calculation,
> this happens when the local sched group type is group_fully_busy,
> and the average load of local group is greater than the selected
> busiest group. Fix this problem by comparing the average load of the
> local and busiest group before imbalance calculation formula.
>
> Suggested-by: Vincent Guittot <vincent.guittot@linaro.org>
> Signed-off-by: Aubrey Li <aubrey.li@linux.intel.com>
> Cc: Phil Auld <pauld@redhat.com>

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

> ---
>  kernel/sched/fair.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index c1217bf..4a2ba3f 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8761,6 +8761,14 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
>
>                 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.
> +                */
> +               if (local->avg_load >= busiest->avg_load) {
> +                       env->imbalance = 0;
> +                       return;
> +               }
>         }
>
>         /*
> --
> 2.7.4
>

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

* Re: [PATCH] sched/fair: Fix negative imbalance in imbalance calculation
  2020-03-26  5:42 [PATCH] sched/fair: Fix negative imbalance in imbalance calculation Aubrey Li
  2020-03-26 13:30 ` Phil Auld
  2020-03-26 16:03 ` Vincent Guittot
@ 2020-03-27 11:48 ` Mel Gorman
  2020-04-08 12:20 ` [tip: sched/urgent] " tip-bot2 for Aubrey Li
  3 siblings, 0 replies; 6+ messages in thread
From: Mel Gorman @ 2020-03-27 11:48 UTC (permalink / raw)
  To: Aubrey Li
  Cc: vincent.guittot, mingo, peterz, juri.lelli, dietmar.eggemann,
	rostedt, bsegall, linux-kernel, tim.c.chen, vpillai, joel,
	Aubrey Li, Phil Auld

On Thu, Mar 26, 2020 at 01:42:29PM +0800, Aubrey Li wrote:
> A negative imbalance value was observed after imbalance calculation,
> this happens when the local sched group type is group_fully_busy,
> and the average load of local group is greater than the selected
> busiest group. Fix this problem by comparing the average load of the
> local and busiest group before imbalance calculation formula.
> 
> Suggested-by: Vincent Guittot <vincent.guittot@linaro.org>
> Signed-off-by: Aubrey Li <aubrey.li@linux.intel.com>
> Cc: Phil Auld <pauld@redhat.com>

Acked-by: Mel Gorman <mgorman@suse.de>

-- 
Mel Gorman
SUSE Labs

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

* Re: [PATCH] sched/fair: Fix negative imbalance in imbalance calculation
  2020-03-26 16:03 ` Vincent Guittot
@ 2020-03-30 10:38   ` Peter Zijlstra
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Zijlstra @ 2020-03-30 10:38 UTC (permalink / raw)
  To: Vincent Guittot
  Cc: Aubrey Li, Ingo Molnar, Juri Lelli, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, linux-kernel, Tim Chen,
	Vineeth Pillai, Joel Fernandes, Aubrey Li, Phil Auld

On Thu, Mar 26, 2020 at 05:03:10PM +0100, Vincent Guittot wrote:
> On Thu, 26 Mar 2020 at 06:53, Aubrey Li <aubrey.li@intel.com> wrote:
> >
> > A negative imbalance value was observed after imbalance calculation,
> > this happens when the local sched group type is group_fully_busy,
> > and the average load of local group is greater than the selected
> > busiest group. Fix this problem by comparing the average load of the
> > local and busiest group before imbalance calculation formula.
> >
> > Suggested-by: Vincent Guittot <vincent.guittot@linaro.org>
> > Signed-off-by: Aubrey Li <aubrey.li@linux.intel.com>
> > Cc: Phil Auld <pauld@redhat.com>
> 
> Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>

Thanks!

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

* [tip: sched/urgent] sched/fair: Fix negative imbalance in imbalance calculation
  2020-03-26  5:42 [PATCH] sched/fair: Fix negative imbalance in imbalance calculation Aubrey Li
                   ` (2 preceding siblings ...)
  2020-03-27 11:48 ` Mel Gorman
@ 2020-04-08 12:20 ` tip-bot2 for Aubrey Li
  3 siblings, 0 replies; 6+ messages in thread
From: tip-bot2 for Aubrey Li @ 2020-04-08 12:20 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Vincent Guittot, Phil Auld, Mel Gorman, Aubrey Li,
	Peter Zijlstra (Intel),
	Ingo Molnar, x86, LKML

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

Commit-ID:     111688ca1c4a43a7e482f5401f82c46326b8ed49
Gitweb:        https://git.kernel.org/tip/111688ca1c4a43a7e482f5401f82c46326b8ed49
Author:        Aubrey Li <aubrey.li@intel.com>
AuthorDate:    Thu, 26 Mar 2020 13:42:29 +08:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 08 Apr 2020 11:35:20 +02:00

sched/fair: Fix negative imbalance in imbalance calculation

A negative imbalance value was observed after imbalance calculation,
this happens when the local sched group type is group_fully_busy,
and the average load of local group is greater than the selected
busiest group. Fix this problem by comparing the average load of the
local and busiest group before imbalance calculation formula.

Suggested-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Phil Auld <pauld@redhat.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Acked-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Aubrey Li <aubrey.li@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lkml.kernel.org/r/1585201349-70192-1-git-send-email-aubrey.li@intel.com
---
 kernel/sched/fair.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 95cbd9e..02f323b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9036,6 +9036,14 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
 
 		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.
+		 */
+		if (local->avg_load >= busiest->avg_load) {
+			env->imbalance = 0;
+			return;
+		}
 	}
 
 	/*

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

end of thread, other threads:[~2020-04-08 12:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26  5:42 [PATCH] sched/fair: Fix negative imbalance in imbalance calculation Aubrey Li
2020-03-26 13:30 ` Phil Auld
2020-03-26 16:03 ` Vincent Guittot
2020-03-30 10:38   ` Peter Zijlstra
2020-03-27 11:48 ` Mel Gorman
2020-04-08 12:20 ` [tip: sched/urgent] " tip-bot2 for Aubrey Li

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).