Re: [patch v7 05/21] sched: log the cpu utilization at rq
From: Alex Shi
Date: Mon May 06 2013 - 08:35:43 EST
On 05/06/2013 08:03 PM, Phil Carmody wrote:
>> > + period = rq->avg.runnable_avg_period ? rq->avg.runnable_avg_period : 1;
>> > + rq->util = (u64)(rq->avg.runnable_avg_sum << SCHED_POWER_SHIFT)
>> > + / period;
> Greetings, Alex.
>
> That cast achieves nothing where it is. If the shift has overflowed,
> then you've already lost information; and if it can't overflow, then
> it's not needed at all.
>
> It's itsy-bitsy, but note that there exists a div_u64(u64 dividend,
> u32 divisor) helper which may be implemented to be superior to just '/'.
> (And also note that the assignment to ``period'' is a good candidate for
> gcc's ``?:'' operator.)
>
> If you pull the cast inside the brackets, then you may add my
> Reviewed-by: Phil Carmody <pc+lkml@xxxxxxxx>
You are right, Phil!
Thanks for review! :)
--
Thanks
Alex
--
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/