Re: [PATCH] fix granularity of task_u/stime(), v2

From: Peter Zijlstra
Date: Thu Nov 12 2009 - 09:16:26 EST


On Thu, 2009-11-12 at 13:33 +0900, Hidetoshi Seto wrote:
> Originally task_s/utime() were designed to return clock_t but later
> changed to return cputime_t by following commit:
>
> commit efe567fc8281661524ffa75477a7c4ca9b466c63
> Author: Christian Borntraeger <borntraeger@xxxxxxxxxx>
> Date: Thu Aug 23 15:18:02 2007 +0200
>
> It only changed the type of return value, but not the implementation.
> As the result the granularity of task_s/utime() is still that of
> clock_t, not that of cputime_t.
>
> So using task_s/utime() in __exit_signal() makes values accumulated
> to the signal struct to be rounded and coarse grained.
>
> This patch removes casts to clock_t in task_u/stime(), to keep
> granularity of cputime_t over the calculation.
>
> v2:
> Use div_u64() to avoid error "undefined reference to `__udivdi3`"
> on some 32bit systems.
>
> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@xxxxxxxxxxxxxx>

/me hates all the cputime_t and clock_t mess.. but I guess the patch is
good.

Thanks.


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