rcu: Use per_cpu_ptr to get the pointer of per_cpu variable
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 63 lines · Liu Song
From: Liu Song <[email protected]>
In rcu, most codes have used
per_cpu_ptrto obtainper_cpuvariable pointers. This patch adjusts a few codes that have not done so.Signed-off-by Liu Song <[email protected]>--- kernel/rcu/tasks.h | 2 +- kernel/rcu/tree.c | 4 ++-- kernel/rcu/tree_stall.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)kernel/rcu/tasks.h +1
-1@@ -875,7 +875,7 @@ static void trc_read_check_handler(void *t_in)// Allow future IPIs to be sent on CPU and for task. // Also order this IPI handler against any later manipulations of // the intended task. -smp_store_release (&per_cpu (trc_ipi_to_cpu,smp_processor_id ()), false);// ^^^ +smp_store_release (per_cpu_ptr (&trc_ipi_to_cpu,smp_processor_id ()), false);// ^^^ smp_store_release (&texp->trc_ipi_to_cpu,-1 );// ^^^ }kernel/rcu/tree.c +2
-2@@ -399,7 +399,7 @@ bool rcu_eqs_special_set(int cpu)int old;int new;int new_old; -struct rcu_data *rdp = &per_cpu (rcu_data, cpu); +struct rcu_data *rdp =per_cpu_ptr (&rcu_data, cpu); new_old =atomic_read (&rdp->dynticks); do {@@ -1333,7 +1333,7 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp)*/ jtsq =READ_ONCE (jiffies_to_sched_qs); ruqp =per_cpu_ptr (&rcu_data.rcu_urgent_qs, rdp->cpu); - rnhqp = &per_cpu (rcu_data.rcu_need_heavy_qs, rdp->cpu); + rnhqp =per_cpu_ptr (&rcu_data.rcu_need_heavy_qs, rdp->cpu); if (!READ_ONCE(*rnhqp) && (time_after(jiffies, rcu_state.gp_start + jtsq * 2) || time_after(jiffies, rcu_state.jiffies_resched) ||kernel/rcu/tree_stall.h +1
-1@@ -349,7 +349,7 @@ static void rcu_dump_cpu_stacks(void)static void print_cpu_stall_fast_no_hz (char *cp,int cpu) { -struct rcu_data *rdp = &per_cpu (rcu_data, cpu); +struct rcu_data *rdp =per_cpu_ptr (&rcu_data, cpu); sprintf(cp, "last_accelerate: %04lx/%04lx dyntick_enabled: %d", rdp->last_accelerate & 0xffff, jiffies & 0xffff,Signature · 1 line
2.20.1
To me it looks OK.
--
Vlad Rezki
Neeraj Upadhyay
Reviewed-byQuoted 5 lines · Liu Song
From: Liu Song <[email protected]>
In rcu, most codes have used
per_cpu_ptrto obtainper_cpuvariable pointers. This patch adjusts a few codes that have not done so.
Minor: Can we also add below statement?
"This patch doesn't introduce any functional change."
Quoted 25 lines
Signed-off-by Liu Song <[email protected]>--- kernel/rcu/tasks.h | 2 +- kernel/rcu/tree.c | 4 ++-- kernel/rcu/tree_stall.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)kernel/rcu/tasks.h +1
-1@@ -875,7 +875,7 @@ static void trc_read_check_handler(void *t_in)// Allow future IPIs to be sent on CPU and for task. // Also order this IPI handler against any later manipulations of // the intended task. -smp_store_release (&per_cpu (trc_ipi_to_cpu,smp_processor_id ()), false);// ^^^ +smp_store_release (per_cpu_ptr (&trc_ipi_to_cpu,smp_processor_id ()), false);// ^^^ smp_store_release (&texp->trc_ipi_to_cpu,-1 );// ^^^ }kernel/rcu/tree.c +0
-0
kernel/rcu/tree.c bool rcu_eqs_special_set(int cpu) · line 402
Quoted 5 lines
kernel/rcu/tree.c +1
-1@@ -399,7 +399,7 @@ bool rcu_eqs_special_set(int cpu)int old;int new;int new_old; -struct rcu_data *rdp = &per_cpu (rcu_data, cpu); +struct rcu_data *rdp =per_cpu_ptr (&rcu_data, cpu);
rcu_eqs_special_set() does not exist in rcu dev branch [1]; so this might need rebase.
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/tree/kernel/rcu/tree.c?h=dev
Quoted 18 lines
kernel/rcu/tree.c +1
-1new_old =atomic_read (&rdp->dynticks); do {@@ -1333,7 +1333,7 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp)*/ jtsq =READ_ONCE (jiffies_to_sched_qs); ruqp =per_cpu_ptr (&rcu_data.rcu_urgent_qs, rdp->cpu); - rnhqp = &per_cpu (rcu_data.rcu_need_heavy_qs, rdp->cpu); + rnhqp =per_cpu_ptr (&rcu_data.rcu_need_heavy_qs, rdp->cpu); if (!READ_ONCE(*rnhqp) && (time_after(jiffies, rcu_state.gp_start + jtsq * 2) || time_after(jiffies, rcu_state.jiffies_resched) ||kernel/rcu/tree_stall.h +0
-0
kernel/rcu/tree_stall.h static void rcu_dump_cpu_stacks(void) · line 355
Quoted 8 lines
kernel/rcu/tree_stall.h +1
-1@@ -349,7 +349,7 @@ static void rcu_dump_cpu_stacks(void)static void print_cpu_stall_fast_no_hz (char *cp,int cpu) { -struct rcu_data *rdp = &per_cpu (rcu_data, cpu); +struct rcu_data *rdp =per_cpu_ptr (&rcu_data, cpu); sprintf(cp, "last_accelerate: %04lx/%04lx dyntick_enabled: %d", rdp->last_accelerate & 0xffff, jiffies & 0xffff,
Thanks
Neeraj
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Quoted 13 lines · Neeraj Upadhyay
Quoted 5 lines · Liu Song
From: Liu Song <[email protected]>
In rcu, most codes have used
per_cpu_ptrto obtainper_cpuvariable pointers. This patch adjusts a few codes that have not done so.Minor: Can we also add below statement?
"This patch doesn't introduce any functional change."Quoted 1 line
Signed-off-by Liu Song <[email protected]>
Applied with the usual wordsmithing, including adding words to this effect, so thank you all! I removed the obsolete chunk that Neeraj pointed out as well.
Please take a look and check to see if all is well.
Thanx, Paul
------------------------------------------------------------------------
commit 9a6b5a10785f4d9b4f073736e6648fa3851882bd
Author: Liu Song <[email protected]> Date: Wed Jun 30 22:08:02 2021 +0800
rcu: Use per_cpu_ptr to get the pointer of per_cpu variable
There are a few remaining locations in kernel/rcu that still use "&per_cpu()". This commit replaces them with "per_cpu_ptr(&)", and does not introduce any functional change..
kernel/rcu/tasks.h +1 -1
@@ -923,7 +923,7 @@ static void trc_read_check_handler(void *t_in)// Allow future IPIs to be sent on CPU and for task. // Also order this IPI handler against any later manipulations of // the intended task. -smp_store_release (&per_cpu (trc_ipi_to_cpu,smp_processor_id ()), false);// ^^^ +smp_store_release (per_cpu_ptr (&trc_ipi_to_cpu,smp_processor_id ()), false);// ^^^ smp_store_release (&texp->trc_ipi_to_cpu,-1 );// ^^^ }
kernel/rcu/tree.c +1 -1
@@ -1290,7 +1290,7 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp)*/ jtsq =READ_ONCE (jiffies_to_sched_qs); ruqp =per_cpu_ptr (&rcu_data.rcu_urgent_qs, rdp->cpu); - rnhqp = &per_cpu (rcu_data.rcu_need_heavy_qs, rdp->cpu); + rnhqp =per_cpu_ptr (&rcu_data.rcu_need_heavy_qs, rdp->cpu); if (!READ_ONCE(*rnhqp) && (time_after(jiffies, rcu_state.gp_start + jtsq * 2) || time_after(jiffies, rcu_state.jiffies_resched) ||
kernel/rcu/tree_stall.h +1 -1
@@ -351,7 +351,7 @@ static void rcu_dump_cpu_stacks(void)static void print_cpu_stall_fast_no_hz (char *cp,int cpu) { -struct rcu_data *rdp = &per_cpu (rcu_data, cpu); +struct rcu_data *rdp =per_cpu_ptr (&rcu_data, cpu); sprintf(cp, "last_accelerate: %04lx/%04lx dyntick_enabled: %d", rdp->last_accelerate & 0xffff, jiffies & 0xffff,
Quoted 13 lines · Paul E. McKenney
Quoted 12 lines · Neeraj Upadhyay
Quoted 5 lines · Liu Song
From: Liu Song <[email protected]>
In rcu, most codes have used
per_cpu_ptrto obtainper_cpuvariable pointers. This patch adjusts a few codes that have not done so.Minor: Can we also add below statement?
"This patch doesn't introduce any functional change."
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Signed-off-by Liu Song <[email protected]>Applied with the usual wordsmithing, including adding words to this effect, so thank you all! I removed the obsolete chunk that Neeraj pointed out as well.
Please take a look and check to see if all is well.
Looks good to me
Thanks
Neeraj
Quoted 59 lines
Thanx, Paul
------------------------------------------------------------------------
commit
9a6b5a10785f4d9b4f073736e6648fa3851882bdAuthor: Liu Song <[email protected]> Date: Wed Jun 30 22:08:02 2021 +0800rcu: Use
per_cpu_ptrto get the pointer ofper_cpuvariableThere are a few remaining locations in kernel/rcu that still use "
&per_cpu()". This commit replaces them with "per_cpu_ptr(&)", and does not introduce any functional change..Reviewed-by Uladzislau Rezki (Sony) <[email protected]>Reviewed-by Neeraj Upadhyay <[email protected]>Signed-off-by Liu Song <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>kernel/rcu/tasks.h +1
-1@@ -923,7 +923,7 @@ static void trc_read_check_handler(void *t_in)// Allow future IPIs to be sent on CPU and for task. // Also order this IPI handler against any later manipulations of // the intended task. -smp_store_release (&per_cpu (trc_ipi_to_cpu,smp_processor_id ()), false);// ^^^ +smp_store_release (per_cpu_ptr (&trc_ipi_to_cpu,smp_processor_id ()), false);// ^^^ smp_store_release (&texp->trc_ipi_to_cpu,-1 );// ^^^ }kernel/rcu/tree.c +1
-1@@ -1290,7 +1290,7 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp)*/ jtsq =READ_ONCE (jiffies_to_sched_qs); ruqp =per_cpu_ptr (&rcu_data.rcu_urgent_qs, rdp->cpu); - rnhqp = &per_cpu (rcu_data.rcu_need_heavy_qs, rdp->cpu); + rnhqp =per_cpu_ptr (&rcu_data.rcu_need_heavy_qs, rdp->cpu); if (!READ_ONCE(*rnhqp) && (time_after(jiffies, rcu_state.gp_start + jtsq * 2) || time_after(jiffies, rcu_state.jiffies_resched) ||kernel/rcu/tree_stall.h +1
-1@@ -351,7 +351,7 @@ static void rcu_dump_cpu_stacks(void)static void print_cpu_stall_fast_no_hz (char *cp,int cpu) { -struct rcu_data *rdp = &per_cpu (rcu_data, cpu); +struct rcu_data *rdp =per_cpu_ptr (&rcu_data, cpu); sprintf(cp, "last_accelerate: %04lx/%04lx dyntick_enabled: %d", rdp->last_accelerate & 0xffff, jiffies & 0xffff,
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Uladzislau Rezki
maintainerQuoted 18 lines · Neeraj Upadhyay
Quoted 15 lines · Paul E. McKenney
Quoted 13 lines · Neeraj Upadhyay
Quoted 5 lines · Liu Song
From: Liu Song <[email protected]>
In rcu, most codes have used
per_cpu_ptrto obtainper_cpuvariable pointers. This patch adjusts a few codes that have not done so.Minor: Can we also add below statement?
"This patch doesn't introduce any functional change."Quoted 1 line
Signed-off-by Liu Song <[email protected]>
Quoted 9 lines
Quoted 6 lines
Applied with the usual wordsmithing, including adding words to this effect, so thank you all! I removed the obsolete chunk that Neeraj pointed out as well.
Please take a look and check to see if all is well.
Looks good to me
Same to me. Looks good.
There are two dots though in the commit message: "change.." :)
--
Vlad Rezki
Paul E. McKenney
maintainerQuoted 23 lines · Uladzislau Rezki
Quoted 22 lines · Neeraj Upadhyay
Quoted 19 lines · Paul E. McKenney
Quoted 13 lines · Neeraj Upadhyay
Quoted 5 lines · Liu Song
From: Liu Song <[email protected]>
In rcu, most codes have used
per_cpu_ptrto obtainper_cpuvariable pointers. This patch adjusts a few codes that have not done so.Minor: Can we also add below statement?
"This patch doesn't introduce any functional change."Quoted 1 line
Signed-off-by Liu Song <[email protected]>Applied with the usual wordsmithing, including adding words to this effect, so thank you all! I removed the obsolete chunk that Neeraj pointed out as well.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Please take a look and check to see if all is well.
Looks good to me
Same to me. Looks good.
There are two dots though in the commit message: "change.." :)
Good eyes, fixed, thank you!
Thanx, Paul
Joel Fernandes
Reviewed-byQuoted 28 lines · Paul E. McKenney
Quoted 26 lines · Uladzislau Rezki
Quoted 25 lines · Neeraj Upadhyay
Quoted 21 lines · Paul E. McKenney
Quoted 13 lines · Neeraj Upadhyay
Quoted 5 lines · Liu Song
From: Liu Song <[email protected]>
In rcu, most codes have used
per_cpu_ptrto obtainper_cpuvariable pointers. This patch adjusts a few codes that have not done so.Minor: Can we also add below statement?
"This patch doesn't introduce any functional change."Quoted 1 line
Signed-off-by Liu Song <[email protected]>Applied with the usual wordsmithing, including adding words to this effect, so thank you all! I removed the obsolete chunk that Neeraj pointed out as well.
Please take a look and check to see if all is well.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Looks good to me
Same to me. Looks good.
There are two dots though in the commit message: "change.." :)
Good eyes, fixed, thank you!
LGTM as well, thanks!
Paul E. McKenney
maintainerQuoted 31 lines · Joel Fernandes
Quoted 30 lines · Paul E. McKenney
Quoted 28 lines · Uladzislau Rezki
Quoted 27 lines · Neeraj Upadhyay
Quoted 13 lines · Paul E. McKenney
Quoted 12 lines · Neeraj Upadhyay
Quoted 5 lines · Liu Song
From: Liu Song <[email protected]>
In rcu, most codes have used
per_cpu_ptrto obtainper_cpuvariable pointers. This patch adjusts a few codes that have not done so.Minor: Can we also add below statement?
"This patch doesn't introduce any functional change."Quoted 8 lines
Quoted 1 line
Quoted 1 line
Signed-off-by Liu Song <[email protected]>Applied with the usual wordsmithing, including adding words to this effect, so thank you all! I removed the obsolete chunk that Neeraj pointed out as well.
Please take a look and check to see if all is well.
Looks good to me
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Same to me. Looks good.
There are two dots though in the commit message: "change.." :)
Good eyes, fixed, thank you!
LGTM as well, thanks!
Reviewed-by Joel Fernandes (Google) <[email protected]>
And one more. ;-)
Again, thank you all!
Thanx, Paul