mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-01 10:42:11 +00:00
softirq: use bit waits instead of var waits.
The waiting in softirq.c is always waiting for a bit to be cleared. This makes the bit wait functions seem more suitable. By switching over we can rid of all explicit barriers. We also use wait_on_bit_lock() to avoid an explicit loop. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20240925053405.3960701-8-neilb@suse.de
This commit is contained in:
parent
80681c04c5
commit
49994911b4
@ -748,10 +748,8 @@ EXPORT_SYMBOL(__tasklet_hi_schedule);
|
|||||||
|
|
||||||
static bool tasklet_clear_sched(struct tasklet_struct *t)
|
static bool tasklet_clear_sched(struct tasklet_struct *t)
|
||||||
{
|
{
|
||||||
if (test_and_clear_bit(TASKLET_STATE_SCHED, &t->state)) {
|
if (test_and_clear_wake_up_bit(TASKLET_STATE_SCHED, &t->state))
|
||||||
wake_up_var(&t->state);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
WARN_ONCE(1, "tasklet SCHED state not set: %s %pS\n",
|
WARN_ONCE(1, "tasklet SCHED state not set: %s %pS\n",
|
||||||
t->use_callback ? "callback" : "func",
|
t->use_callback ? "callback" : "func",
|
||||||
@ -871,8 +869,7 @@ void tasklet_kill(struct tasklet_struct *t)
|
|||||||
if (in_interrupt())
|
if (in_interrupt())
|
||||||
pr_notice("Attempt to kill tasklet from interrupt\n");
|
pr_notice("Attempt to kill tasklet from interrupt\n");
|
||||||
|
|
||||||
while (test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
|
wait_on_bit_lock(&t->state, TASKLET_STATE_SCHED, TASK_UNINTERRUPTIBLE);
|
||||||
wait_var_event(&t->state, !test_bit(TASKLET_STATE_SCHED, &t->state));
|
|
||||||
|
|
||||||
tasklet_unlock_wait(t);
|
tasklet_unlock_wait(t);
|
||||||
tasklet_clear_sched(t);
|
tasklet_clear_sched(t);
|
||||||
@ -882,16 +879,13 @@ EXPORT_SYMBOL(tasklet_kill);
|
|||||||
#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)
|
#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)
|
||||||
void tasklet_unlock(struct tasklet_struct *t)
|
void tasklet_unlock(struct tasklet_struct *t)
|
||||||
{
|
{
|
||||||
smp_mb__before_atomic();
|
clear_and_wake_up_bit(TASKLET_STATE_RUN, &t->state);
|
||||||
clear_bit(TASKLET_STATE_RUN, &t->state);
|
|
||||||
smp_mb__after_atomic();
|
|
||||||
wake_up_var(&t->state);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(tasklet_unlock);
|
EXPORT_SYMBOL_GPL(tasklet_unlock);
|
||||||
|
|
||||||
void tasklet_unlock_wait(struct tasklet_struct *t)
|
void tasklet_unlock_wait(struct tasklet_struct *t)
|
||||||
{
|
{
|
||||||
wait_var_event(&t->state, !test_bit(TASKLET_STATE_RUN, &t->state));
|
wait_on_bit(&t->state, TASKLET_STATE_RUN, TASK_UNINTERRUPTIBLE);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(tasklet_unlock_wait);
|
EXPORT_SYMBOL_GPL(tasklet_unlock_wait);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user