public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Adaptative busy spinning with rseq
@ 2019-01-16 17:14 Mathieu Desnoyers
  0 siblings, 0 replies; only message in thread
From: Mathieu Desnoyers @ 2019-01-16 17:14 UTC (permalink / raw)
  To: Daniel Colascione
  Cc: Paul Turner, Paul E. McKenney, Andy Lutomirski, Boqun Feng,
	Peter Zijlstra, Thomas Gleixner, linux-kernel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-16 17:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-16 17:14 Adaptative busy spinning with rseq Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox