* [PATCH] srcu: drop the needless initialization in srcu_gp_start()
@ 2022-03-15 8:55 Lukas Bulwahn
2022-03-15 16:52 ` Paul E. McKenney
0 siblings, 1 reply; 3+ messages in thread
From: Lukas Bulwahn @ 2022-03-15 8:55 UTC (permalink / raw)
To: Paul E . McKenney, rcu
Cc: Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
kernel-janitors, linux-kernel, Lukas Bulwahn
Commit 9c7ef4c30f12 ("srcu: Make Tree SRCU able to operate without snp_node
array") initializes the local variable sdp differently depending on the
srcu's state in srcu_gp_start().
Hence, the initialization of sdp with the variable definition is not used
before its second initialization.
Drop the needless initialization in srcu_gp_start() to have clear code.
No functional change. Some changes in the resulting object code due to
various rearrangements by the compiler.
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
Paul, please pick this minor non-urgent clean-up patch.
kernel/rcu/srcutree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index 328dd9ba9037..470da67325d6 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -598,7 +598,7 @@ EXPORT_SYMBOL_GPL(__srcu_read_unlock);
*/
static void srcu_gp_start(struct srcu_struct *ssp)
{
- struct srcu_data *sdp = this_cpu_ptr(ssp->sda);
+ struct srcu_data *sdp;
int state;
if (smp_load_acquire(&ssp->srcu_size_state) < SRCU_SIZE_WAIT_BARRIER)
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] srcu: drop the needless initialization in srcu_gp_start()
2022-03-15 8:55 [PATCH] srcu: drop the needless initialization in srcu_gp_start() Lukas Bulwahn
@ 2022-03-15 16:52 ` Paul E. McKenney
2022-03-15 17:04 ` Lukas Bulwahn
0 siblings, 1 reply; 3+ messages in thread
From: Paul E. McKenney @ 2022-03-15 16:52 UTC (permalink / raw)
To: Lukas Bulwahn
Cc: rcu, Josh Triplett, Steven Rostedt, Mathieu Desnoyers,
Lai Jiangshan, kernel-janitors, linux-kernel
On Tue, Mar 15, 2022 at 09:55:49AM +0100, Lukas Bulwahn wrote:
> Commit 9c7ef4c30f12 ("srcu: Make Tree SRCU able to operate without snp_node
> array") initializes the local variable sdp differently depending on the
> srcu's state in srcu_gp_start().
>
> Hence, the initialization of sdp with the variable definition is not used
> before its second initialization.
>
> Drop the needless initialization in srcu_gp_start() to have clear code.
>
> No functional change. Some changes in the resulting object code due to
> various rearrangements by the compiler.
>
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> ---
> Paul, please pick this minor non-urgent clean-up patch.
Good eyes, thank you!
I have pulled this in for testing and review. If things go will,
I expect to push it into the v5.19 merge window (that is, not the one
that will likely open next week, but the one after that).
As usual, I could not resist wordsmithing the commit log. Could you
please check out the wordsmithed version below to make sure that I did
not mess something up?
Thanx, Paul
------------------------------------------------------------------------
commit a0c59d99e87c52d6832e1ad39421b4a4386cdfd6
Author: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Date: Tue Mar 15 09:55:49 2022 +0100
srcu: Drop needless initialization of sdp in srcu_gp_start()
Commit 9c7ef4c30f12 ("srcu: Make Tree SRCU able to operate without
snp_node array") initializes the local variable sdp differently depending
on the srcu's state in srcu_gp_start(). Either way, this initialization
overwrites the value used when sdp is defined.
This commit therefore drops this pointless definition-time initialization.
Although there is no functional change, compiler code generation may
be affected.
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index e78b1c7929d6..3bc8267c5d0b 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -609,7 +609,7 @@ EXPORT_SYMBOL_GPL(__srcu_read_unlock);
*/
static void srcu_gp_start(struct srcu_struct *ssp)
{
- struct srcu_data *sdp = this_cpu_ptr(ssp->sda);
+ struct srcu_data *sdp;
int state;
if (smp_load_acquire(&ssp->srcu_size_state) < SRCU_SIZE_WAIT_BARRIER)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] srcu: drop the needless initialization in srcu_gp_start()
2022-03-15 16:52 ` Paul E. McKenney
@ 2022-03-15 17:04 ` Lukas Bulwahn
0 siblings, 0 replies; 3+ messages in thread
From: Lukas Bulwahn @ 2022-03-15 17:04 UTC (permalink / raw)
To: Paul McKenny
Cc: rcu, Josh Triplett, Steven Rostedt, Mathieu Desnoyers,
Lai Jiangshan, kernel-janitors, Linux Kernel Mailing List
On Tue, Mar 15, 2022 at 5:52 PM Paul E. McKenney <paulmck@kernel.org> wrote:
>
> On Tue, Mar 15, 2022 at 09:55:49AM +0100, Lukas Bulwahn wrote:
> > Commit 9c7ef4c30f12 ("srcu: Make Tree SRCU able to operate without snp_node
> > array") initializes the local variable sdp differently depending on the
> > srcu's state in srcu_gp_start().
> >
> > Hence, the initialization of sdp with the variable definition is not used
> > before its second initialization.
> >
> > Drop the needless initialization in srcu_gp_start() to have clear code.
> >
> > No functional change. Some changes in the resulting object code due to
> > various rearrangements by the compiler.
> >
> > Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> > ---
> > Paul, please pick this minor non-urgent clean-up patch.
>
> Good eyes, thank you!
>
> I have pulled this in for testing and review. If things go will,
> I expect to push it into the v5.19 merge window (that is, not the one
> that will likely open next week, but the one after that).
>
> As usual, I could not resist wordsmithing the commit log. Could you
> please check out the wordsmithed version below to make sure that I did
> not mess something up?
>
Wordsmithing was good. I am basically still reading in your versions
what I intended to state with my commit message; +1!
And of course, you are a native speaker; so, I trust your English is
better than mine.
Lukas
> Thanx, Paul
>
> ------------------------------------------------------------------------
>
> commit a0c59d99e87c52d6832e1ad39421b4a4386cdfd6
> Author: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> Date: Tue Mar 15 09:55:49 2022 +0100
>
> srcu: Drop needless initialization of sdp in srcu_gp_start()
>
> Commit 9c7ef4c30f12 ("srcu: Make Tree SRCU able to operate without
> snp_node array") initializes the local variable sdp differently depending
> on the srcu's state in srcu_gp_start(). Either way, this initialization
> overwrites the value used when sdp is defined.
>
> This commit therefore drops this pointless definition-time initialization.
> Although there is no functional change, compiler code generation may
> be affected.
>
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
>
> diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> index e78b1c7929d6..3bc8267c5d0b 100644
> --- a/kernel/rcu/srcutree.c
> +++ b/kernel/rcu/srcutree.c
> @@ -609,7 +609,7 @@ EXPORT_SYMBOL_GPL(__srcu_read_unlock);
> */
> static void srcu_gp_start(struct srcu_struct *ssp)
> {
> - struct srcu_data *sdp = this_cpu_ptr(ssp->sda);
> + struct srcu_data *sdp;
> int state;
>
> if (smp_load_acquire(&ssp->srcu_size_state) < SRCU_SIZE_WAIT_BARRIER)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-15 17:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-15 8:55 [PATCH] srcu: drop the needless initialization in srcu_gp_start() Lukas Bulwahn
2022-03-15 16:52 ` Paul E. McKenney
2022-03-15 17:04 ` Lukas Bulwahn
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).