diff options
| author | Linus Torvalds <torvalds@athlon.transmeta.com> | 2002-02-04 19:14:56 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@athlon.transmeta.com> | 2002-02-04 19:14:56 -0800 |
| commit | 80b4c191cbea7c104e825a4e7e94980dcb33fee0 (patch) | |
| tree | c3800eade99949f8158b64ba36052a04618444d8 /kernel/softirq.c | |
| parent | 6fbaac38b85e4bd3936b882392e3a9b45e8acb46 (diff) | |
v2.4.7.1 -> v2.4.7.2
- Kai Germaschewski: ISDN updates
- David Miller: sparc and network updates
- Andrea Arcangeli, Maksim Krasnyanskiy: tasklet fixes
- Stelian Pop: Motion Eye camera driver update
- Jens Axboe: DAC960 update
Diffstat (limited to 'kernel/softirq.c')
| -rw-r--r-- | kernel/softirq.c | 74 |
1 files changed, 29 insertions, 45 deletions
diff --git a/kernel/softirq.c b/kernel/softirq.c index fa94305456b5..3737fa91fb4f 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -140,41 +140,29 @@ void open_softirq(int nr, void (*action)(struct softirq_action*), void *data) /* Tasklets */ struct tasklet_head tasklet_vec[NR_CPUS] __cacheline_aligned; +struct tasklet_head tasklet_hi_vec[NR_CPUS] __cacheline_aligned; -void tasklet_schedule(struct tasklet_struct *t) +void __tasklet_schedule(struct tasklet_struct *t) { + int cpu = smp_processor_id(); unsigned long flags; - int cpu; - cpu = smp_processor_id(); local_irq_save(flags); - /* - * If nobody is running it then add it to this CPU's - * tasklet queue. - */ - if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) { - t->next = tasklet_vec[cpu].list; - tasklet_vec[cpu].list = t; - cpu_raise_softirq(cpu, TASKLET_SOFTIRQ); - tasklet_unlock(t); - } + t->next = tasklet_vec[cpu].list; + tasklet_vec[cpu].list = t; + cpu_raise_softirq(cpu, TASKLET_SOFTIRQ); local_irq_restore(flags); } -void tasklet_hi_schedule(struct tasklet_struct *t) +void __tasklet_hi_schedule(struct tasklet_struct *t) { + int cpu = smp_processor_id(); unsigned long flags; - int cpu; - cpu = smp_processor_id(); local_irq_save(flags); - - if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) { - t->next = tasklet_hi_vec[cpu].list; - tasklet_hi_vec[cpu].list = t; - cpu_raise_softirq(cpu, HI_SOFTIRQ); - tasklet_unlock(t); - } + t->next = tasklet_hi_vec[cpu].list; + tasklet_hi_vec[cpu].list = t; + cpu_raise_softirq(cpu, HI_SOFTIRQ); local_irq_restore(flags); } @@ -193,29 +181,25 @@ static void tasklet_action(struct softirq_action *a) list = list->next; - if (!tasklet_trylock(t)) - BUG(); - if (!atomic_read(&t->count)) { - if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state)) - BUG(); - t->func(t->data); + if (tasklet_trylock(t)) { + if (!atomic_read(&t->count)) { + if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state)) + BUG(); + t->func(t->data); + tasklet_unlock(t); + continue; + } tasklet_unlock(t); - continue; } - tasklet_unlock(t); local_irq_disable(); t->next = tasklet_vec[cpu].list; tasklet_vec[cpu].list = t; - cpu_raise_softirq(cpu, TASKLET_SOFTIRQ); local_irq_enable(); + __cpu_raise_softirq(cpu, TASKLET_SOFTIRQ); } } - - -struct tasklet_head tasklet_hi_vec[NR_CPUS] __cacheline_aligned; - static void tasklet_hi_action(struct softirq_action *a) { int cpu = smp_processor_id(); @@ -231,22 +215,22 @@ static void tasklet_hi_action(struct softirq_action *a) list = list->next; - if (!tasklet_trylock(t)) - BUG(); - if (!atomic_read(&t->count)) { - if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state)) - BUG(); - t->func(t->data); + if (tasklet_trylock(t)) { + if (!atomic_read(&t->count)) { + if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state)) + BUG(); + t->func(t->data); + tasklet_unlock(t); + continue; + } tasklet_unlock(t); - continue; } - tasklet_unlock(t); local_irq_disable(); t->next = tasklet_hi_vec[cpu].list; tasklet_hi_vec[cpu].list = t; - cpu_raise_softirq(cpu, HI_SOFTIRQ); local_irq_enable(); + __cpu_raise_softirq(cpu, HI_SOFTIRQ); } } |
