mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	Clark Williams <williams@redhat.com>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	John Kacur <jkacur@redhat.com>
Subject: Re: [RFC][PATCH tip/sched/core] sched/rt: Simplify the IPI rt balancing logic
Date: Mon, 24 Apr 2017 15:50:45 +0200	[thread overview]
Message-ID: <20170424135045.blkchz5lwzf4ksgo@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20170424132835.berjg6jakizu5s4v@home.goodmis.org>

On Mon, Apr 24, 2017 at 09:28:36AM -0400, Steven Rostedt wrote:

> > static inline bool rto_start_trylock(atomic_t *v)
> > {
> > 	int zero = 0;
> > 	return atomic_try_cmpxchg(v, &zero, 1);
> 
> To keep the same semantics of spin_trylock(), should we:

try_cmpxchg returns the success of the "cmp" part. So if the above
returns true, the "cmp" part was a success and we did the "xchg" part,
so we now own the lock.

That's right, no?

>   return !atomic_cmpxchg(v, &zero, 1);
> 
> as the old value of zero means we got it.

The same, but results in an extra compare instruction to compare the
result, instead of using the one cmpxchg already did.

> BTW, I don't see any atomic_try_cmpxchg().

a9ebf306f52c ("locking/atomic: Introduce atomic_try_cmpxchg()")

Should be in tip someplace.

  reply	other threads:[~2017-04-24 13:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-22  2:49 Steven Rostedt
2017-04-22 18:41 ` Steven Rostedt
2017-04-24  8:51 ` Peter Zijlstra
2017-04-24 12:43   ` Steven Rostedt
2017-04-24 12:46     ` Steven Rostedt
2017-04-24 12:52     ` Peter Zijlstra
2017-04-24 13:28       ` Steven Rostedt
2017-04-24 13:50         ` Peter Zijlstra [this message]
2017-04-24  8:57 ` Peter Zijlstra
2017-04-24 12:43   ` Steven Rostedt
2017-04-24 15:53 ` [PATCH RT v2] " Steven Rostedt

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=20170424135045.blkchz5lwzf4ksgo@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bristot@redhat.com \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.com \
    /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

all inboxes | Powered by JetHome®