public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Daniel Colascione <dancol@google.com>
Cc: Paul Turner <pjt@google.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Boqun Feng <boqun.feng@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Adaptative busy spinning with rseq
Date: Wed, 16 Jan 2019 12:14:41 -0500 (EST)	[thread overview]
Message-ID: <1584600558.1675.1547658881995.JavaMail.zimbra@efficios.com> (raw)

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

                 reply	other threads:[~2019-01-16 17:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1584600558.1675.1547658881995.JavaMail.zimbra@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=boqun.feng@gmail.com \
    --cc=dancol@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox