[PATCH 20/30] sched: fix load scaling in group balancing



doing the load balance will change cfs_rq->load.weight (that's the whole point)
but since that's part of the scale factor, we'll scale back with a different
amount.

Weight getting smaller would result in an inflated moved_load which causes
it to stop balancing too soon.

Signed-off-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
---
kernel/sched_fair.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

Index: linux-2.6/kernel/sched_fair.c
===================================================================
--- linux-2.6.orig/kernel/sched_fair.c
+++ linux-2.6/kernel/sched_fair.c
@@ -1449,6 +1449,8 @@ load_balance_fair(struct rq *this_rq, in

list_for_each_entry(tg, &task_groups, list) {
struct cfs_rq *busiest_cfs_rq = tg->cfs_rq[busiest_cpu];
+ unsigned long busiest_h_load = busiest_cfs_rq->h_load;
+ unsigned long busiest_weight = busiest_cfs_rq->load.weight;
long rem_load, moved_load;

/*
@@ -1457,8 +1459,8 @@ load_balance_fair(struct rq *this_rq, in
if (!busiest_cfs_rq->task_weight)
continue;

- rem_load = rem_load_move * busiest_cfs_rq->load.weight;
- rem_load /= busiest_cfs_rq->h_load + 1;
+ rem_load = rem_load_move * busiest_weight;
+ rem_load /= busiest_h_load + 1;

moved_load = __load_balance_fair(this_rq, this_cpu, busiest,
rem_load, sd, idle, all_pinned, this_best_prio,
@@ -1467,8 +1469,8 @@ load_balance_fair(struct rq *this_rq, in
if (!moved_load)
continue;

- moved_load *= busiest_cfs_rq->h_load;
- moved_load /= busiest_cfs_rq->load.weight + 1;
+ moved_load *= busiest_h_load;
+ moved_load /= busiest_weight + 1;

rem_load_move -= moved_load;
if (rem_load_move < 0)

--

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



Relevant Pages

  • Re: [Slightly OT] Dealing with fractions of cents
    ... functions includes reading a weight from a scale and then multiplying ... that weight by a UnitPrice to get an amount. ... The scale returns its weight in pounds to 3 decimal places. ...
    (microsoft.public.dotnet.languages.csharp)
  • QFTCICR Game 7 Rounds 2-3: energy, eponymous titles
    ... One degree of temperature in the Fahrenheit scale equals ... Who was the inventor? ... What is the basic SI unit of energy, ... Girl gains weight. ...
    (rec.games.trivia)
  • Re: QFTCICR Game 7 Rounds 2-3: energy, eponymous titles
    ... One degree of temperature in the Fahrenheit scale equals ... Who was the inventor? ... What is the basic SI unit of energy, ... Girl gains weight. ...
    (rec.games.trivia)
  • Re: How do I weigh a large object?
    ... |>> high, with a ramp, but obviously I can't weight the cart in one shot. ... |>> What I was thinking was that if I weighed it one wheel at a time I ... If the scale does not depress very much and you have room ... | The risk of building this platform may be that things get tippy. ...
    (sci.physics)
  • Re: D@mn it I DID misplace a person!
    ... spent time in the gym that could have been ... according to the scale in her office, ... never mind the underpants I had to trash because theyr're falling off ... I can't wish my weight away. ...
    (rec.pets.cats.anecdotes)