bug/code cleanup for O(1)-K3

kravetz@us.ibm.com
Thu, 14 Feb 2002 09:27:46 -0800


In the K3 version of the O(1) scheduler for 2.4.17 there is
either a bug or an opportunity for some code cleanup. At
the beginning of the load_balance() routine we set the local
variable 'nr_running' and use this variable to calculate the
value of 'imbalance'. After this the variable is not used,
even though we go to the trouble of passing it to
double_lock_balance() so that it can be possibly be recomputed.
Note the code:

imbalance = (max_load - nr_running) / 2;

/* It needs an at least ~25% imbalance to trigger balancing. */
if (!idle && (imbalance < (max_load + 3)/4))
return;

nr_running = double_lock_balance(this_rq, busiest, this_cpu, idle, nr_running);
/*
* Make sure nothing changed since we checked the
* runqueue length.
*/
if (busiest->nr_running <= this_rq->nr_running + 1)
goto out_unlock;

In the last if statement above, I suspect we want to compare
'busiest->nr_running' to the local variable nr_running (as was
done in previous versions of the code). If this is not the
case, then we can simplify double_lock_balance() and make it
return a void.

P.S. I've only been working with the 2.4.17 version of the patch,
but I assume the code is the same in other versions.

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