Re: [PATCH 2/8] cputime: Librarize per nsecs resolution cputime definitions

From: Kevin Hilman
Date: Thu Feb 14 2013 - 14:49:47 EST

Frederic Weisbecker <fweisbec@xxxxxxxxx> writes:

> The full dynticks cputime accounting that we'll soon introduce
> will rely on sched_clock(). And its clock can have a per
> nanosecond granularity.
> To prepare for this, we need to have a cputime_t implementation
> that has this precision.
> ia64 virtual cputime accounting already uses that granularity
> so all we need is to librarize its implementation in the asm
> generic headers.

...except that for it to be truly generic (i.e. usable on 32-bit arches),
it should be using do_div() for 64-bit divides.

I understand this series is targetted at 64-bit platforms currently, but
I'm looking (again) at getting adaptive NOHZ working on ARM, and this
was the first obvious obstacle to even compiling.

I see this is already merged into tip/sched/core, so below is a patch on
top of that to convert to using do_div(). If you're OK with the
approach, I'll post it formally to LKML.