All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Neeraj Upadhyay <neeraju@codeaurora.org>
Cc: Liu Song <fishland@aliyun.com>,
	liu.song11@zte.com.cn, rcu@vger.kernel.org
Subject: Re: [PATCH] rcu: Use per_cpu_ptr to get the pointer of per_cpu variable
Date: Thu, 1 Jul 2021 09:31:15 -0700	[thread overview]
Message-ID: <20210701163115.GE4397@paulmck-ThinkPad-P17-Gen-1> (raw)
In-Reply-To: <85a49682-a196-65e5-b0a4-52f51b76626c@codeaurora.org>

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@zte.com.cn>
> > 
> > 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@zte.com.cn>

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@zte.com.cn>
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@gmail.com>
    Reviewed-by: Neeraj Upadhyay <neeraju@codeaurora.org>
    Signed-off-by: Liu Song <liu.song11@zte.com.cn>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

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,

  reply	other threads:[~2021-07-01 16:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210630140802.39138-1-fishland@aliyun.com>
2021-06-30 18:57 ` [PATCH] rcu: Use per_cpu_ptr to get the pointer of per_cpu variable Uladzislau Rezki
2021-07-01 14:54 ` Neeraj Upadhyay
2021-07-01 16:31   ` Paul E. McKenney [this message]
2021-07-01 17:05     ` Neeraj Upadhyay
2021-07-01 18:39       ` Uladzislau Rezki
2021-07-01 19:57         ` Paul E. McKenney
2021-07-01 20:03           ` Joel Fernandes
2021-07-01 23:47             ` Paul E. McKenney

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=20210701163115.GE4397@paulmck-ThinkPad-P17-Gen-1 \
    --to=paulmck@kernel.org \
    --cc=fishland@aliyun.com \
    --cc=liu.song11@zte.com.cn \
    --cc=neeraju@codeaurora.org \
    --cc=rcu@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.