linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpu/hotplug: simplify access percpu cpuhp_state
@ 2021-05-23 13:31 Yuan ZhaoXiong
  2021-05-25 10:19 ` Valentin Schneider
  2021-05-25 15:30 ` [tip: smp/core] cpu/hotplug: Simplify access to " tip-bot2 for Yuan ZhaoXiong
  0 siblings, 2 replies; 3+ messages in thread
From: Yuan ZhaoXiong @ 2021-05-23 13:31 UTC (permalink / raw)
  To: peterz, vincent.donnefort, valentin.schneider, mingo, bristot,
	npiggin, tglx
  Cc: linux-kernel

It is unnecessary to invoke per_cpu_ptr() function everytime to access
percpu cpuhp_state and use the variable st instead.

Signed-off-by: Yuan ZhaoXiong <yuanzhaoxiong@baidu.com>
---
 kernel/cpu.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index e538518..2942cb4 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -961,7 +961,7 @@ static int takedown_cpu(unsigned int cpu)
 	int err;
 
 	/* Park the smpboot threads */
-	kthread_park(per_cpu_ptr(&cpuhp_state, cpu)->thread);
+	kthread_park(st->thread);
 
 	/*
 	 * Prevent irq alloc/free while the dying cpu reorganizes the
@@ -977,7 +977,7 @@ static int takedown_cpu(unsigned int cpu)
 		/* CPU refused to die */
 		irq_unlock_sparse();
 		/* Unpark the hotplug thread so we can rollback there */
-		kthread_unpark(per_cpu_ptr(&cpuhp_state, cpu)->thread);
+		kthread_unpark(st->thread);
 		return err;
 	}
 	BUG_ON(cpu_online(cpu));
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpu/hotplug: simplify access percpu cpuhp_state
  2021-05-23 13:31 [PATCH] cpu/hotplug: simplify access percpu cpuhp_state Yuan ZhaoXiong
@ 2021-05-25 10:19 ` Valentin Schneider
  2021-05-25 15:30 ` [tip: smp/core] cpu/hotplug: Simplify access to " tip-bot2 for Yuan ZhaoXiong
  1 sibling, 0 replies; 3+ messages in thread
From: Valentin Schneider @ 2021-05-25 10:19 UTC (permalink / raw)
  To: Yuan ZhaoXiong, peterz, vincent.donnefort, mingo, bristot, npiggin, tglx
  Cc: linux-kernel

On 23/05/21 21:31, Yuan ZhaoXiong wrote:
> It is unnecessary to invoke per_cpu_ptr() function everytime to access
> percpu cpuhp_state and use the variable st instead.
>
> Signed-off-by: Yuan ZhaoXiong <yuanzhaoxiong@baidu.com>

Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>

> ---
>  kernel/cpu.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index e538518..2942cb4 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -961,7 +961,7 @@ static int takedown_cpu(unsigned int cpu)
>       int err;
>
>       /* Park the smpboot threads */
> -	kthread_park(per_cpu_ptr(&cpuhp_state, cpu)->thread);
> +	kthread_park(st->thread);
>
>       /*
>        * Prevent irq alloc/free while the dying cpu reorganizes the
> @@ -977,7 +977,7 @@ static int takedown_cpu(unsigned int cpu)
>               /* CPU refused to die */
>               irq_unlock_sparse();
>               /* Unpark the hotplug thread so we can rollback there */
> -		kthread_unpark(per_cpu_ptr(&cpuhp_state, cpu)->thread);
> +		kthread_unpark(st->thread);
>               return err;
>       }
>       BUG_ON(cpu_online(cpu));
> --
> 1.7.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: smp/core] cpu/hotplug: Simplify access to percpu cpuhp_state
  2021-05-23 13:31 [PATCH] cpu/hotplug: simplify access percpu cpuhp_state Yuan ZhaoXiong
  2021-05-25 10:19 ` Valentin Schneider
@ 2021-05-25 15:30 ` tip-bot2 for Yuan ZhaoXiong
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Yuan ZhaoXiong @ 2021-05-25 15:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Yuan ZhaoXiong, Thomas Gleixner, Valentin Schneider, x86, linux-kernel

The following commit has been merged into the smp/core branch of tip:

Commit-ID:     130708331bc6b03a3c3a78599333faddfebbd0f3
Gitweb:        https://git.kernel.org/tip/130708331bc6b03a3c3a78599333faddfebbd0f3
Author:        Yuan ZhaoXiong <yuanzhaoxiong@baidu.com>
AuthorDate:    Sun, 23 May 2021 21:31:30 +08:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 25 May 2021 17:24:52 +02:00

cpu/hotplug: Simplify access to percpu cpuhp_state

It is unnecessary to invoke per_cpu_ptr() everytime to access cpuhp_state.
Use the available pointer instead.

Signed-off-by: Yuan ZhaoXiong <yuanzhaoxiong@baidu.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Link: https://lore.kernel.org/r/1621776690-13264-1-git-send-email-yuanzhaoxiong@baidu.com

---
 kernel/cpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index e538518..2942cb4 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -961,7 +961,7 @@ static int takedown_cpu(unsigned int cpu)
 	int err;
 
 	/* Park the smpboot threads */
-	kthread_park(per_cpu_ptr(&cpuhp_state, cpu)->thread);
+	kthread_park(st->thread);
 
 	/*
 	 * Prevent irq alloc/free while the dying cpu reorganizes the
@@ -977,7 +977,7 @@ static int takedown_cpu(unsigned int cpu)
 		/* CPU refused to die */
 		irq_unlock_sparse();
 		/* Unpark the hotplug thread so we can rollback there */
-		kthread_unpark(per_cpu_ptr(&cpuhp_state, cpu)->thread);
+		kthread_unpark(st->thread);
 		return err;
 	}
 	BUG_ON(cpu_online(cpu));

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-25 15:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23 13:31 [PATCH] cpu/hotplug: simplify access percpu cpuhp_state Yuan ZhaoXiong
2021-05-25 10:19 ` Valentin Schneider
2021-05-25 15:30 ` [tip: smp/core] cpu/hotplug: Simplify access to " tip-bot2 for Yuan ZhaoXiong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).