lkml.org 
[lkml]   [2010]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] sched_clock: Provide local_clock() and improve documentation
From
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.

The function could be written as follows (thanks Salman Qazi):

u64 local_clock(unsigned int *where)
{
u64 clock;
unsigned long flags;

local_irq_save(flags);
*where = smp_processor_id();
clock = sched_clock_cpu(*where);
local_irq_restore(flags);

return clock;
}

but I don't see the utility of the resulting routine.

Chad
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-05-28 20:13    [W:0.138 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site