mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched: fix: remove double calculation in fix_small_imbalance
@ 2014-03-11 16:26 Vincent Guittot
  2014-03-12  9:00 ` Peter Zijlstra
  2014-03-12 10:10 ` [tip:sched/core] sched: Remove double calculation in fix_small_imbalance() tip-bot for Vincent Guittot
  0 siblings, 2 replies; 4+ messages in thread
From: Vincent Guittot @ 2014-03-11 16:26 UTC (permalink / raw)
  To: peterz, mingo, linux-kernel; +Cc: Vincent Guittot

The tmp value has been already calculated in:
scaled_busy_load_per_task =
		(busiest->load_per_task * SCHED_POWER_SCALE) /
		busiest->group_power;

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
---
 kernel/sched/fair.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index f1eedae..b301918 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6061,12 +6061,10 @@ void fix_small_imbalance(struct lb_env *env, struct sd_lb_stats *sds)
 	pwr_now /= SCHED_POWER_SCALE;
 
 	/* Amount of load we'd subtract */
-	tmp = (busiest->load_per_task * SCHED_POWER_SCALE) /
-		busiest->group_power;
-	if (busiest->avg_load > tmp) {
+	if (busiest->avg_load > scaled_busy_load_per_task) {
 		pwr_move += busiest->group_power *
 			    min(busiest->load_per_task,
-				busiest->avg_load - tmp);
+				busiest->avg_load - scaled_busy_load_per_task);
 	}
 
 	/* Amount of load we'd add */
-- 
1.9.0


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

* Re: [PATCH] sched: fix: remove double calculation in fix_small_imbalance
  2014-03-11 16:26 [PATCH] sched: fix: remove double calculation in fix_small_imbalance Vincent Guittot
@ 2014-03-12  9:00 ` Peter Zijlstra
  2014-03-12 12:56   ` Vincent Guittot
  2014-03-12 10:10 ` [tip:sched/core] sched: Remove double calculation in fix_small_imbalance() tip-bot for Vincent Guittot
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2014-03-12  9:00 UTC (permalink / raw)
  To: Vincent Guittot; +Cc: mingo, linux-kernel

On Tue, Mar 11, 2014 at 05:26:06PM +0100, Vincent Guittot wrote:
> The tmp value has been already calculated in:
> scaled_busy_load_per_task =
> 		(busiest->load_per_task * SCHED_POWER_SCALE) /
> 		busiest->group_power;

You created a little confusion in my brain by saying it was a fix; while
in fact it is an optimization removing duplicate computation.

I've changed the Subject to read:

  sched: Remove double calculation in fix_small_imbalance


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

* [tip:sched/core] sched: Remove double calculation in fix_small_imbalance()
  2014-03-11 16:26 [PATCH] sched: fix: remove double calculation in fix_small_imbalance Vincent Guittot
  2014-03-12  9:00 ` Peter Zijlstra
@ 2014-03-12 10:10 ` tip-bot for Vincent Guittot
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Vincent Guittot @ 2014-03-12 10:10 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, vincent.guittot, tglx

Commit-ID:  a2cd42601b474b957e1a5fe3692bcf7f9363bd51
Gitweb:     http://git.kernel.org/tip/a2cd42601b474b957e1a5fe3692bcf7f9363bd51
Author:     Vincent Guittot <vincent.guittot@linaro.org>
AuthorDate: Tue, 11 Mar 2014 17:26:06 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 12 Mar 2014 10:49:00 +0100

sched: Remove double calculation in fix_small_imbalance()

The tmp value has been already calculated in:

  scaled_busy_load_per_task =
		(busiest->load_per_task * SCHED_POWER_SCALE) /
		busiest->group_power;

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1394555166-22894-1-git-send-email-vincent.guittot@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/fair.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index f1eedae..b301918 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6061,12 +6061,10 @@ void fix_small_imbalance(struct lb_env *env, struct sd_lb_stats *sds)
 	pwr_now /= SCHED_POWER_SCALE;
 
 	/* Amount of load we'd subtract */
-	tmp = (busiest->load_per_task * SCHED_POWER_SCALE) /
-		busiest->group_power;
-	if (busiest->avg_load > tmp) {
+	if (busiest->avg_load > scaled_busy_load_per_task) {
 		pwr_move += busiest->group_power *
 			    min(busiest->load_per_task,
-				busiest->avg_load - tmp);
+				busiest->avg_load - scaled_busy_load_per_task);
 	}
 
 	/* Amount of load we'd add */

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

* Re: [PATCH] sched: fix: remove double calculation in fix_small_imbalance
  2014-03-12  9:00 ` Peter Zijlstra
@ 2014-03-12 12:56   ` Vincent Guittot
  0 siblings, 0 replies; 4+ messages in thread
From: Vincent Guittot @ 2014-03-12 12:56 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, linux-kernel

On 12 March 2014 10:00, Peter Zijlstra <peterz@infradead.org> wrote:
> On Tue, Mar 11, 2014 at 05:26:06PM +0100, Vincent Guittot wrote:
>> The tmp value has been already calculated in:
>> scaled_busy_load_per_task =
>>               (busiest->load_per_task * SCHED_POWER_SCALE) /
>>               busiest->group_power;
>
> You created a little confusion in my brain by saying it was a fix; while
> in fact it is an optimization removing duplicate computation.

sorry for the confusion.

>
> I've changed the Subject to read:
>
>   sched: Remove double calculation in fix_small_imbalance
>

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

end of thread, other threads:[~2014-03-12 12:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-11 16:26 [PATCH] sched: fix: remove double calculation in fix_small_imbalance Vincent Guittot
2014-03-12  9:00 ` Peter Zijlstra
2014-03-12 12:56   ` Vincent Guittot
2014-03-12 10:10 ` [tip:sched/core] sched: Remove double calculation in fix_small_imbalance() tip-bot for 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®