lkml.org 
[lkml]   [2013]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch v7 05/21] sched: log the cpu utilization at rq
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@asdf.org>

You are right, Phil!
Thanks for review! :)

--
Thanks
Alex


\
 
 \ /
  Last update: 2013-05-06 15:21    [W:0.103 / U:1.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site