Re: [Question] load balance move tasks not suitable ?

From: Peter Zijlstra
Date: Mon Jul 30 2018 - 11:59:38 EST



A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

On Mon, Jul 30, 2018 at 09:42:27PM +0800, weiqi (C) wrote:
> in latest linux kernel version, load-balance's detach_tasks() keeps
> "load/2" behavior:
>
> """
>
> if (( load / 2 ) > env->imbalance)
> goto next;
> """
>
> It means a task "p", which load is 1.5 times than "env->imbalance" can
> move from "src_rq" to "dst_rq".
> after this move, imbalance between "src_rq" and "dst_rq" may larger than
> before.

imbalance is how much we should move to get in balance. So if we move 1
imbalance we'll end up being just right. If we move 1.5 we end up
slightly better then before, but imbalanced the other way.

If we move 2 imbalance, we're exactly where we were, just the other way
around.

> but if use "load*2" here, It means we can pick a task "p" , which load is
> half of "env->imbalance"ï and after moveï
> "src_rq" and "dst_rq" is balanced.

We might not move anything and not improve even if we could.