All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neeraj Upadhyay <neeraju@codeaurora.org>
To: Liu Song <fishland@aliyun.com>, paulmck@kernel.org
Cc: 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 20:24:32 +0530	[thread overview]
Message-ID: <85a49682-a196-65e5-b0a4-52f51b76626c@codeaurora.org> (raw)
In-Reply-To: <20210630140802.39138-1-fishland@aliyun.com>



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>
> ---
>   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);

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

>   
>   	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,
>

Reviewed-by: Neeraj Upadhyay <neeraju@codeaurora.org>



Thanks
Neeraj

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a 
member of the Code Aurora Forum, hosted by The Linux Foundation

  parent reply	other threads:[~2021-07-01 14:55 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 [this message]
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=85a49682-a196-65e5-b0a4-52f51b76626c@codeaurora.org \
    --to=neeraju@codeaurora.org \
    --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 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.