lkml.org 
[lkml]   [2019]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectAdaptative busy spinning with rseq
Hi!

A follow up on the Edinburgh discussion I had with Daniel: I did a prototype
implementation of adaptative busy spinning with rseq. It only uses current
upstream rseq features. It's not optimized at this stage (and I don't have time to
work more on it at the moment), and it's only x86-64, but I'm throwing the code out
there for feedback:

https://github.com/compudj/rseq-test/blob/adapt-lock/test-rseq-adaptative-lock.c

The trick here is to rely on the Zero Flag being invariant for a sub-section of
the rseq critical sections, and use it to figure out if it has been aborted
after cmpxchg has succeeded. Testing the Zero Flag on abort basically removes the
rseq requirement that the very last instruction of a rseq critical section needs
to be the "commit" instruction, allowing us to cover an entire loop within a rseq
critical section.

Feedback is welcome!

Thanks,

Mathieu

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

\
 
 \ /
  Last update: 2019-01-16 18:14    [W:0.027 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site