Re: [PATCH v2 3/3] sched: increase SCHED_LOAD_SCALE resolution
From: Nikhil Rao
Date: Wed May 18 2011 - 15:40:42 EST
On Wed, May 18, 2011 at 11:25 AM, Ingo Molnar <mingo@xxxxxxx> wrote:
>
> * Nikhil Rao <ncrao@xxxxxxxxxx> wrote:
>
>> -#define SCHED_LOAD_SHIFT Â Â 10
>> +#if BITS_PER_LONG > 32
>> +#define SCHED_LOAD_RESOLUTION Â Â Â Â10
>> +#define scale_load(w) Â Â Â Â Â Â Â Â(w << SCHED_LOAD_RESOLUTION)
>> +#define scale_load_down(w) Â (w >> SCHED_LOAD_RESOLUTION)
>> +#else
>> +#define SCHED_LOAD_RESOLUTION Â Â Â Â0
>> +#define scale_load(w) Â Â Â Â Â Â Â Âw
>> +#define scale_load_down(w) Â w
>> +#endif
>
> Please use the:
>
> #if X
> # define Y A
> #else
> # define Y B
> #endif
>
> type of nested CPP branching style.
>
> Also, the 'w' probably wants to be '(w)', just in case.
Thanks for the review. Will fix the macros.
>
>> Â Â Â if (!lw->inv_weight) {
>> - Â Â Â Â Â Â if (BITS_PER_LONG > 32 && unlikely(lw->weight >= WMULT_CONST))
>> + Â Â Â Â Â Â unsigned long w = scale_load_down(lw->weight);
>> + Â Â Â Â Â Â if (BITS_PER_LONG > 32 && unlikely(w >= WMULT_CONST))
>> Â Â Â Â Â Â Â Â Â Â Â lw->inv_weight = 1;
>
> Please separate local variable declarations and the first statement following
> it by an extra empty line.
>
Yes, will do.
> Could you also put all the performance measurement description into the
> changelog of this third commit - so that people can see (and enjoy) the
> extensive testing you have done on this topic?
>
Yes, will add the performance changes to the commit description.
>> Â/*
>> - * Increase resolution of nice-level calculations:
>> + * Increase resolution of nice-level calculations for 64-bit architectures.
>> Â */
>> -#define SCHED_LOAD_SHIFT Â Â 10
>> +#if BITS_PER_LONG > 32
>> +#define SCHED_LOAD_RESOLUTION Â Â Â Â10
>> +#define scale_load(w) Â Â Â Â Â Â Â Â(w << SCHED_LOAD_RESOLUTION)
>> +#define scale_load_down(w) Â (w >> SCHED_LOAD_RESOLUTION)
>> +#else
>> +#define SCHED_LOAD_RESOLUTION Â Â Â Â0
>> +#define scale_load(w) Â Â Â Â Â Â Â Âw
>> +#define scale_load_down(w) Â w
>> +#endif
>
> Please also be a bit more verbose in the comment above why we treat 64-bit
> architectures differently - it's not obvious.
Added a more descriptive comment.
Thanks for the review. I'll refresh the patch and send it with the fixes.
-Thanks,
Nikhil
--
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/