Skip to contentSkip to conversation

tasklet_unlock_wait() cpu_relax()

PATCH In review Andreas Mohr 3 participants 3 messages Jun 14, 2006 – Jun 16, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tasklet_unlock_wait() cpu_relax()

Hi all,

use cpu_relax() here, too (instead of barrier()).

include/linux/interrupt.h +1 -1
diff -urN linux-2.6.17-rc6-mm2.orig/include/linux/interrupt.h linux-2.6.17-rc6-mm2.my/include/linux/interrupt.h
@@ -227,7 +227,7 @@
 
 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
#2 lore raw
In reply to Andreas Mohr
Quoted 11 lines · Andreas Mohr

Hi all,

use cpu_relax() here, too (instead of barrier()).

diff -urN linux-2.6.17-rc6-mm2.orig/include/linux/interrupt.h linux-2.6.17-rc6-mm2.my/include/linux/interrupt.h

include/linux/interrupt.h line 231

Quoted 6 lines
include/linux/interrupt.h +1 -1
@@ -227,7 +227,7 @@
 
 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(); }
 }

While you're at it could you reformat it to proper kernel style, e.g.:

static inline void tasklet_unlock_wait(struct tasklet_struct *t)

{
	while (test_bit(TASKLET_STATE_RUN, &t->state))
		cpu_relax();
}