The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	the arch/x86 maintainers <x86@kernel.org>
Subject: Re: [GIT pull] locking/urgent for v5.15-rc2
Date: Mon, 20 Sep 2021 13:27:26 +0200	[thread overview]
Message-ID: <YUhwHsx8n0KJWgQP@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CAHk-=wiFY6Ys0bOrUUsocp_1YHt_9aEBi9CtPt4N0bRUTY8+5Q@mail.gmail.com>

On Sun, Sep 19, 2021 at 01:10:45PM -0700, Linus Torvalds wrote:
> On Sun, Sep 19, 2021 at 11:28 AM Thomas Gleixner <tglx@linutronix.de> wrote:
> >
> >
> > -       atomic_add(READER_BIAS - bias, &rwb->readers);
> > +       /*
> > +        * _release() is needed in case that reader is in fast path, pairing
> > +        * with atomic_try_cmpxchg() in rwbase_read_trylock(), provides RELEASE
> > +        */
> > +       (void)atomic_add_return_release(READER_BIAS - bias, &rwb->readers);
> 
> Ugh. This really needs fixing.
> 
> atomic_add() is already much more than release-ordered on x86, and
> atomic_add_return_release() is much more expensive on some uarchs.

Is that XADD really more expensive? I don't think I've ever seen that.
Anyway, sure, we can go create atomic_{add,sub}_release() and replace
the few occurences we have of this (a quick grep shows this is the 3rd
such).

  reply	other threads:[~2021-09-20 11:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-19 18:28 [GIT pull] locking/urgent for v5.15-rc2 Thomas Gleixner
2021-09-19 18:28 ` [GIT pull] perf/urgent " Thomas Gleixner
2021-09-19 20:36   ` pr-tracker-bot
2021-09-19 18:28 ` [GIT pull] x86/urgent " Thomas Gleixner
2021-09-19 18:39   ` Borislav Petkov
2021-09-19 18:47     ` [GIT PULL] Updated " Borislav Petkov
2021-09-19 20:36       ` pr-tracker-bot
2021-09-19 20:10 ` [GIT pull] locking/urgent " Linus Torvalds
2021-09-20 11:27   ` Peter Zijlstra [this message]
2021-09-20 15:23     ` Linus Torvalds
2021-09-19 20:36 ` pr-tracker-bot

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=YUhwHsx8n0KJWgQP@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /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