Fwd: [PATCH] spinlock spin with pause instruction

Václav Haisman vhaisman@gmail.com
Sat Mar 12 08:14:00 GMT 2016


On 12.3.2016 07:25, Mark Geisert wrote:
> Václav Haisman wrote:
>> Hi.
>>
>> I have noticed that Cygwin's spinlock goes into heavy sleeping code
>> for each spin. It seems it would be a good idea to actually try to
>> spin a bit first. There is this 'pause' instruction which let's the
>> CPU make such busy loops be less busy. Here is a patch to do this.
> 
> I wanted to try out this patch but compilation is failing on the
> "unlikely" call.  Is that a macro that needs defining or something else?
> Thanks,
> 
> ..mark
> 

`unlikely()` is a macro defined in `miscfuncs.h`, right below header
guard:
<https://cygwin.com/git/gitweb.cgi?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/miscfuncs.h;h=3a9f0258c6cbb62b8d51e96c0c5542b70659e17b;hb=HEAD>

-- 
VH

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20160312/c59ef4e1/attachment.sig>


More information about the Cygwin-patches mailing list