diff mbox

sched: fix: remove double calculation in fix_small_imbalance

Message ID 1394555166-22894-1-git-send-email-vincent.guittot@linaro.org
State Accepted
Commit a2cd42601b474b957e1a5fe3692bcf7f9363bd51
Headers show

Commit Message

Vincent Guittot March 11, 2014, 4:26 p.m. UTC
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(-)

Comments

Peter Zijlstra March 12, 2014, 9 a.m. UTC | #1
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Vincent Guittot March 12, 2014, 12:56 p.m. UTC | #2
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
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

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 */