lkml.org 
[lkml]   [2009]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] add function spin_event_timeout()
Jiri Slaby wrote:
> On 9.3.2009 21:32, Timur Tabi wrote:
>> +#define spin_event_timeout(condition, timeout) \
>> +({ \
>> + int __timeout = timeout; \
>> + while (!(condition)&& --__timeout) { \
>> + udelay(1); \
>> + cpu_relax(); \
>
> So you don't need cpu_relax anymore...

I checked the udelay() code. It varies per platform, but I didn't see
how it always replicated the functionality of cpu_relax(). For example,
in x86_64, cpu_relax is a "rep; nop;". But I don't see that code
sequence in arch/x86/lib/delay.c.

So I presume that something in the delay functions makes cpu_relax()
unnecessary. What exactly is the purpose of cpu_relax()?

> And I would make timeout UL like delay functions.

I made it an integer because I don't expect anyone to pass a value
larger than 2^31, but I'll change it.

--
Timur Tabi
Linux kernel developer at Freescale


\
 
 \ /
  Last update: 2009-03-09 21:57    [W:0.041 / U:3.520 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site