Re: [PATCH] rcu: Use per_cpu_ptr to get the pointer of per_cpu variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 01, 2021 at 08:24:32PM +0530, Neeraj Upadhyay wrote:
> 
> 
> On 6/30/2021 7:38 PM, Liu Song wrote:
> > From: Liu Song <liu.song11@xxxxxxxxxx>
> > 
> > In rcu, most codes have used per_cpu_ptr to obtain per_cpu variable
> > 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."
> 
> > Signed-off-by: Liu Song <liu.song11@xxxxxxxxxx>

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 <liu.song11@xxxxxxxxxx>
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..
    
    Reviewed-by: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx>
    Reviewed-by: Neeraj Upadhyay <neeraju@xxxxxxxxxxxxxx>
    Signed-off-by: Liu Song <liu.song11@xxxxxxxxxx>
    Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index f9f52daacd1c..806160c44b17 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -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); // ^^^
 }
 
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index a627a200a5ae..f42b98af3ed3 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -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) ||
diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
index a8d0fcf0826f..677ee3d8671b 100644
--- a/kernel/rcu/tree_stall.h
+++ b/kernel/rcu/tree_stall.h
@@ -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,



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux