[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wj-5vtA_-9xs6zV0U20LRaRhVeE1Ky7X+9kHeucrb6_ig@mail.gmail.com>
Date: Wed, 28 Jul 2021 11:57:14 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: "Paul E. McKenney" <paulmck@...nel.org>
Cc: rcu <rcu@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Kernel Team <kernel-team@...com>,
Ingo Molnar <mingo@...nel.org>,
Lai Jiangshan <jiangshanlai@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Josh Triplett <josh@...htriplett.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Steven Rostedt <rostedt@...dmis.org>,
David Howells <dhowells@...hat.com>,
Eric Dumazet <edumazet@...gle.com>,
Frédéric Weisbecker <fweisbec@...il.com>,
Oleg Nesterov <oleg@...hat.com>,
Joel Fernandes <joel@...lfernandes.org>
Subject: Re: [PATCH v2 rcu 04/18] rcu: Weaken ->dynticks accesses and updates
On Wed, Jul 28, 2021 at 11:46 AM Paul E. McKenney <paulmck@...nel.org> wrote:
>
> But atomic_read_this_cpu(&rcu_data.dynticks) isn't all that much shorter
> than atomic_read(this_cpu_ptr(&rcu_data.dynticks)).
It's not so much that it's shorter to write for a human, it's that we
could generate better code for it.
That atomic_read(this_cpu_ptr()) pattern generates code like
movq $rcu_data+288, %rax
add %gs:this_cpu_off(%rip), %rax
movl (%rax), %eax
but it *could* just generate
movl %gs:rcu_data+288, %rax
instead.
Similar patterns for the other per-cpu atomics, ie it would be
possible to just generate
lock ; xaddl %gs:..., %rax
instead of generating the address by doing that "add %gs:this_cpu_off" thing..
But no, it doesn't look like there are enough users of this to matter.
We're just talking a few extra bytes, and a couple of extra
instructions (and possibly slightly higher register pressure, which
then generates more instructions).
The *expensive* part remains the SMP serialization of the "lock".
Linus
Powered by blists - more mailing lists