Re: [PATCH v3 2/3] sched: factor out code to should_we_balance()

From: Peter Zijlstra
Date: Thu Aug 15 2013 - 07:20:28 EST


On Tue, Aug 06, 2013 at 05:36:42PM +0900, Joonsoo Kim wrote:

Another one of these patches I should stare in more detail at..

> static int load_balance(int this_cpu, struct rq *this_rq,
> struct sched_domain *sd, enum cpu_idle_type idle,
> - int *balance)
> + int *should_balance)
> {
> int ld_moved, cur_ld_moved, active_balance = 0;
> struct sched_group *group;
> @@ -5073,12 +5070,14 @@ static int load_balance(int this_cpu, struct rq *this_rq,
>
> schedstat_inc(sd, lb_count[idle]);
>
> -redo:
> - group = find_busiest_group(&env, balance);
> -
> - if (*balance == 0)
> + if (!should_we_balance(&env)) {
> + *should_balance = 0;
> goto out_balanced;
> + } else
> + *should_balance = 1;

--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5120,11 +5120,8 @@ static int load_balance(int this_cpu, st

schedstat_inc(sd, lb_count[idle]);

- if (!should_we_balance(&env)) {
- *should_balance = 0;
+ if (!(*should_balance = should_we_balance(&env)))
goto out_balanced;
- } else
- *should_balance = 1;

redo:
group = find_busiest_group(&env);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/