linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] softirq: Replace this_cpu_write with __this_cpu_write if irq is disabled
@ 2019-06-18 14:33 Muchun Song
  2019-06-23 16:19 ` [tip:irq/core] softirq: Use __this_cpu_write() in takeover_tasklets() tip-bot for Muchun Song
  2019-06-24 23:04 ` [PATCH] softirq: Replace this_cpu_write with __this_cpu_write if irq is disabled Paul E. McKenney
  0 siblings, 2 replies; 3+ messages in thread
From: Muchun Song @ 2019-06-18 14:33 UTC (permalink / raw)
  To: joel, tglx, mingo, rostedt, frederic, paulmck, alexander.levin, peterz
  Cc: linux-kernel

Irq is disabled before this_cpu_write(), so we can Replace this_cpu_write()
with __this_cpu_write().

Signed-off-by: Muchun Song <smuchun@gmail.com>
---
 kernel/softirq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/softirq.c b/kernel/softirq.c
index 2c3382378d94..eaf3bdf7c749 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -650,7 +650,7 @@ static int takeover_tasklets(unsigned int cpu)
 	/* Find end, append list for that CPU. */
 	if (&per_cpu(tasklet_vec, cpu).head != per_cpu(tasklet_vec, cpu).tail) {
 		*__this_cpu_read(tasklet_vec.tail) = per_cpu(tasklet_vec, cpu).head;
-		this_cpu_write(tasklet_vec.tail, per_cpu(tasklet_vec, cpu).tail);
+		__this_cpu_write(tasklet_vec.tail, per_cpu(tasklet_vec, cpu).tail);
 		per_cpu(tasklet_vec, cpu).head = NULL;
 		per_cpu(tasklet_vec, cpu).tail = &per_cpu(tasklet_vec, cpu).head;
 	}
-- 
2.17.1


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

* [tip:irq/core] softirq: Use __this_cpu_write() in takeover_tasklets()
  2019-06-18 14:33 [PATCH] softirq: Replace this_cpu_write with __this_cpu_write if irq is disabled Muchun Song
@ 2019-06-23 16:19 ` tip-bot for Muchun Song
  2019-06-24 23:04 ` [PATCH] softirq: Replace this_cpu_write with __this_cpu_write if irq is disabled Paul E. McKenney
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Muchun Song @ 2019-06-23 16:19 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: tglx, mingo, linux-kernel, smuchun, hpa

Commit-ID:  8afecaa68df1e94a9d634f1f961533a925f239fc
Gitweb:     https://git.kernel.org/tip/8afecaa68df1e94a9d634f1f961533a925f239fc
Author:     Muchun Song <smuchun@gmail.com>
AuthorDate: Tue, 18 Jun 2019 22:33:05 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sun, 23 Jun 2019 18:14:27 +0200

softirq: Use __this_cpu_write() in takeover_tasklets()

The code is executed with interrupts disabled, so it's safe to use
__this_cpu_write().

[ tglx: Massaged changelog ]

Signed-off-by: Muchun Song <smuchun@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: joel@joelfernandes.org
Cc: rostedt@goodmis.org
Cc: frederic@kernel.org
Cc: paulmck@linux.vnet.ibm.com
Cc: alexander.levin@verizon.com
Cc: peterz@infradead.org
Link: https://lkml.kernel.org/r/20190618143305.2038-1-smuchun@gmail.com

---
 kernel/softirq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/softirq.c b/kernel/softirq.c
index 2c3382378d94..eaf3bdf7c749 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -650,7 +650,7 @@ static int takeover_tasklets(unsigned int cpu)
 	/* Find end, append list for that CPU. */
 	if (&per_cpu(tasklet_vec, cpu).head != per_cpu(tasklet_vec, cpu).tail) {
 		*__this_cpu_read(tasklet_vec.tail) = per_cpu(tasklet_vec, cpu).head;
-		this_cpu_write(tasklet_vec.tail, per_cpu(tasklet_vec, cpu).tail);
+		__this_cpu_write(tasklet_vec.tail, per_cpu(tasklet_vec, cpu).tail);
 		per_cpu(tasklet_vec, cpu).head = NULL;
 		per_cpu(tasklet_vec, cpu).tail = &per_cpu(tasklet_vec, cpu).head;
 	}

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

* Re: [PATCH] softirq: Replace this_cpu_write with __this_cpu_write if irq is disabled
  2019-06-18 14:33 [PATCH] softirq: Replace this_cpu_write with __this_cpu_write if irq is disabled Muchun Song
  2019-06-23 16:19 ` [tip:irq/core] softirq: Use __this_cpu_write() in takeover_tasklets() tip-bot for Muchun Song
@ 2019-06-24 23:04 ` Paul E. McKenney
  1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2019-06-24 23:04 UTC (permalink / raw)
  To: Muchun Song
  Cc: joel, tglx, mingo, rostedt, frederic, alexander.levin, peterz,
	linux-kernel

On Tue, Jun 18, 2019 at 10:33:05PM +0800, Muchun Song wrote:
> Irq is disabled before this_cpu_write(), so we can Replace this_cpu_write()
> with __this_cpu_write().
> 
> Signed-off-by: Muchun Song <smuchun@gmail.com>

This passes light rcutorture testing, and looks rather low risk.

Tested-by: Paul E. McKenney <paulmck@linux.ibm.com>

> ---
>  kernel/softirq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/softirq.c b/kernel/softirq.c
> index 2c3382378d94..eaf3bdf7c749 100644
> --- a/kernel/softirq.c
> +++ b/kernel/softirq.c
> @@ -650,7 +650,7 @@ static int takeover_tasklets(unsigned int cpu)
>  	/* Find end, append list for that CPU. */
>  	if (&per_cpu(tasklet_vec, cpu).head != per_cpu(tasklet_vec, cpu).tail) {
>  		*__this_cpu_read(tasklet_vec.tail) = per_cpu(tasklet_vec, cpu).head;
> -		this_cpu_write(tasklet_vec.tail, per_cpu(tasklet_vec, cpu).tail);
> +		__this_cpu_write(tasklet_vec.tail, per_cpu(tasklet_vec, cpu).tail);
>  		per_cpu(tasklet_vec, cpu).head = NULL;
>  		per_cpu(tasklet_vec, cpu).tail = &per_cpu(tasklet_vec, cpu).head;
>  	}
> -- 
> 2.17.1
> 


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

end of thread, other threads:[~2019-06-24 23:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-18 14:33 [PATCH] softirq: Replace this_cpu_write with __this_cpu_write if irq is disabled Muchun Song
2019-06-23 16:19 ` [tip:irq/core] softirq: Use __this_cpu_write() in takeover_tasklets() tip-bot for Muchun Song
2019-06-24 23:04 ` [PATCH] softirq: Replace this_cpu_write with __this_cpu_write if irq is disabled Paul E. McKenney

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