lkml.org 
[lkml]   [2009]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v4] introduce macro spin_event_timeout()
From
On Thu, Mar 12, 2009 at 11:50 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> sched_clock() does that, but:
> - it falls back to jiffies on poor platforms

I think it's ok to fall back to jiffies where necessary, but these two
functions are too heavy-weight for my tastes.

> But something that seems to always work, is simply count loops and rely
> on whatever delay is in the specified loop.
>
> #define spin_until_timeout(condition, timeout, rc) \
> for (unsigned long __timeout = 0; \
> !(rc = (condition)) && __timeout < (timeout); \
> __timeout++)

But that's the thing - I don't want a required delay inside the loop.

I guess I'm going to have to think about this for a while. I'd like
to see something like cycles_per_usec() as a companion function to
get_cycles().

--
Timur Tabi
Linux kernel developer at Freescale


\
 
 \ /
  Last update: 2009-03-12 20:07    [W:0.054 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site