Re: [PATCH] clarify find_busiest_group

From: Nick Piggin
Date: Fri Jan 23 2004 - 02:10:50 EST




Martin J. Bligh wrote:

Fix a minor nit with the find_busiest_group code. No functional change,
but makes the code simpler and clearer. This patch does two things ... adds some more expansive comments, and removes this if clause:

if (*imbalance < SCHED_LOAD_SCALE
&& max_load - this_load > SCHED_LOAD_SCALE)
*imbalance = SCHED_LOAD_SCALE;

If we remove the scaling factor, we're basically conditionally doing:

if (*imbalance < 1)
*imbalance = 1;

Which is pointless, as the very next thing we do is to remove the scaling
factor, rounding up to the nearest integer as we do:

*imbalance = (*imbalance + SCHED_LOAD_SCALE - 1) >> SCHED_LOAD_SHIFT;

Thus the if statement is redundant, and only makes the code harder to read ;-)


Thanks Martin,
You are right. The redundant code was left over from an older
version. Thanks for the comments too.

Andrew would you like me to take small changes like this and
feed them to you, or are you happy enough to pick them up?
No doubt there will be a a few more.


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