Linux RCU subsystem development
 help / color / mirror / Atom feed
From: Uladzislau Rezki <urezki@gmail.com>
To: Liu Song <fishland@aliyun.com>, paulmck@kernel.org
Cc: paulmck@kernel.org, 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: Wed, 30 Jun 2021 20:57:50 +0200	[thread overview]
Message-ID: <20210630185750.GA56532@pc638.lan> (raw)
In-Reply-To: <20210630140802.39138-1-fishland@aliyun.com>

On Wed, Jun 30, 2021 at 10:08:02PM +0800, 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.
> 
> Signed-off-by: Liu Song <liu.song11@zte.com.cn>
> ---
>  kernel/rcu/tasks.h      | 2 +-
>  kernel/rcu/tree.c       | 4 ++--
>  kernel/rcu/tree_stall.h | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> index 350ebf5051f9..0275217cb6e4 100644
> --- a/kernel/rcu/tasks.h
> +++ b/kernel/rcu/tasks.h
> @@ -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); // ^^^
>  }
>  
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 8e78b2430c16..5cab8e39a731 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -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) ||
> diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
> index 59b95cc5cbdf..990fdb793d57 100644
> --- a/kernel/rcu/tree_stall.h
> +++ b/kernel/rcu/tree_stall.h
> @@ -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,
> -- 
> 2.20.1
> 
To me it looks OK.

Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>

--
Vlad Rezki

       reply	other threads:[~2021-06-30 18:57 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 ` Uladzislau Rezki [this message]
2021-07-01 14:54 ` [PATCH] rcu: Use per_cpu_ptr to get the pointer of per_cpu variable Neeraj Upadhyay
2021-07-01 16:31   ` Paul E. McKenney
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=20210630185750.GA56532@pc638.lan \
    --to=urezki@gmail.com \
    --cc=fishland@aliyun.com \
    --cc=liu.song11@zte.com.cn \
    --cc=paulmck@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox