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.16-rc3
Date: Mon, 29 Nov 2021 09:50:23 +0100 [thread overview]
Message-ID: <YaSUT2roW6SH2OxM@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CAHk-=wh1AZLCtx6Uk1JKpknaHgoLi_DM7221LoRpU6Y_3im03A@mail.gmail.com>
On Sun, Nov 28, 2021 at 09:15:10AM -0800, Linus Torvalds wrote:
> On Sun, Nov 28, 2021 at 8:35 AM Thomas Gleixner <tglx@linutronix.de> wrote:
> >
> > - down_read_trylock() is suboptimal when the lock is contended and
> > multiple readers trylock concurrently. That's due to the initial value
> > being read non-atomically which results in at least two compare exchange
> > loops. Making the initial readout atomic reduces this significantly.
> > Whith 40 readers by 11% in a benchmark which enforces contention on
> > mmap_sem.
>
> This was an intentional optimization to avoid unnecessary cache
> protocol cycles for when the lock isn't contended - first getting a
> cacheline for read ownership, only to then get it for write.
>
> But I guess we don't have any good benchmarks for non-contention, so ...
>
> I also hope that maybe modern hardware is smart enough to see "I will
> write to it later" and avoid the "get line for shared access only to
> get it for exclusive access immediately afterwards" issue.
Yes, I raised that same point, otoh those numbers are not showing that.
They did lightly contended, but I suppose not cache-cold.
next prev parent reply other threads:[~2021-11-29 9:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-28 16:35 [GIT pull] locking/urgent for v5.16-rc3 Thomas Gleixner
2021-11-28 16:35 ` [GIT pull] perf/urgent " Thomas Gleixner
2021-11-28 17:54 ` pr-tracker-bot
2021-11-28 16:35 ` [GIT pull] sched/urgent " Thomas Gleixner
2021-11-28 17:54 ` pr-tracker-bot
2021-11-28 16:35 ` [GIT pull] x86/urgent " Thomas Gleixner
2021-11-28 17:54 ` pr-tracker-bot
2021-11-28 17:15 ` [GIT pull] locking/urgent " Linus Torvalds
2021-11-29 8:50 ` Peter Zijlstra [this message]
2021-11-28 17:54 ` 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=YaSUT2roW6SH2OxM@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;
as well as URLs for NNTP newsgroup(s).