Re: [GIT PULL] cputime: Full dynticks task/cputime accounting v7

From: Kevin Hilman
Date: Thu Feb 14 2013 - 20:55:55 EST


Frederic Weisbecker <fweisbec@xxxxxxxxx> writes:

> Ingo,
>
> Please pull the new full dynticks cputime accounting code that
> can be found at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
> tags/full-dynticks-cputime-for-mingo
>
> My last concern is the dependency on CONFIG_64BIT. We rely on cputime_t
> being u64 for reasonable nanosec granularity implementation. And therefore
> we need a single instruction fetch to read kernel cpustat for atomicity
> requirement against concurrent incrementation, which only 64 bit archs
> can provide.

Actually, moderately recent 32-bit ARMs can do atomic 64-bit load/stores
too.

Also, is it just kernel_cpustat increments that need protection? or do
the various reads of the task_struct's cputime fields also need
protection (hmm, thinking twice, maybe those are already sufficiently
protected by the vtime_seqlock?)

> It's probably no big deal to solve this issue. What we need is simply some
> atomic accessors.

What about using the atomic64_* accessors? Those would just use the
native loads/stores on arches that have them, otherwise
CONFIG_GENERIC_ATOMIC64 provides some fallbacks.

To give it a try, below is a quick patch to convert kernel_cpustat to
atomic64. I only got as far as compile testing and basic boot testing
on a 32-bit ARM platform, but let me know if this is the right
direction.

> There is just no emergency though as this new option depends on the context
> tracking subsystem that only x86-64 (and soon ppc64) implements yet. And
> this set is complex enough already. I think we can deal with that later.

I've started working on the ARM version of the context_tracker, so
"later" is coming quickly and I will do what I can to help this along.

Kevin