[tip: irq/core] tasklets: Replace barrier() with cpu_relax() in tasklet_unlock_wait()

tip-bot2 for Thomas Gleixner
2021-03-17T15:50:53Z

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

Commit-ID: d2da74d1278a1b51ef18beafa9da770f0db1c617
Gitweb: https://git.kernel.org/tip/d2da74d1278a1b51ef18beafa9da770f0db1c617
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 09 Mar 2021 09:42:04 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 17 Mar 2021 16:33:51 +01:00

tasklets: Replace barrier() with cpu_relax() in tasklet_unlock_wait()

A barrier() in a tight loop which waits for something to happen on a remote
CPU is a pointless exercise. Replace it with cpu_relax() which allows HT
siblings to make progress.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210309084241.249343366@linutronix.de

---
include/linux/interrupt.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 2b98156..d689fd7 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -672,7 +672,8 @@ static inline void tasklet_unlock(struct tasklet_struct *t)

static inline void tasklet_unlock_wait(struct tasklet_struct *t)
{
- while (test_bit(TASKLET_STATE_RUN, &(t)->state)) { barrier(); }
+ while (test_bit(TASKLET_STATE_RUN, &t->state))
+ cpu_relax();
}
#else
#define tasklet_trylock(t) 1