Messages in this thread | | | Subject | Re: [PATCH] sched_clock: Provide local_clock() and improve documentation | From | Peter Zijlstra <> | Date | Fri, 28 May 2010 20:22:33 +0200 |
| |
On Fri, 2010-05-28 at 11:11 -0700, Chad Talbott wrote: > On Fri, May 28, 2010 at 6:13 AM, Peter Zijlstra <peterz@infradead.org> wrote: > > + * local_clock() -- is cpu_clock() on the current cpu. > > Pretty sure this should read, "is cpu_clock() on *some* cpu," since > there is no guarantee in a preemptible kernel that local_clock() > returns on the same CPU that it was called from. The caller has to do > the preempt protection itself.
Current cpu simply has no meaning if preemption isn't disabled. If it is, it has and the result is useful.
Some of the local_clock() users are strictly per-cpu (and clearly have preemption disabled), for some there simply is no better clock and simply cope with the small incoherency in time.
| |