Skip to contentSkip to conversation

small bugfix to tasklet_kill

PATCH New Juergen Quade 1 participant 1 message Jan 12, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 small bugfix to tasklet_kill

Find a mini-patch below, which is a bugfix to the tasklet_kill() code. It removes the last line of the function, which clears the TASKLET_STATE_SCHED bit.

Some more explanation:

That a tasklet has been scheduled for processing is marked by the TASKLET_STATE_SCHED bit. If this bit is set, a call to tasklet_schedule() does nothing. If it is cleared, the tasklet is put on the processing queue (call to __tasklet_schedule()). After processing the tasklet the TASKLET_STATE_SCHED bit is cleared (so by calling tasklet_schedule() it will be put on the processing queue).

The trick to kill a tasklet (function tasklet_kill() ) is:
- set the TASKLET_SCHEDULE_BIT, but at the same time
- take care that the tasklet is _not_ on the processing queue.
This is done by waiting for the execution of the tasklet (if it is scheduled) and then _setting_ the bit.

==================================================================
diff -urN linux-2.5.56/kernel/softirq.c linux/kernel/softirq.c
--- linux-2.5.56/kernel/softirq.c 2003-01-02 04:21:21.000000000
+0100
+++ linux/kernel/softirq.c 2003-01-12 10:13:06.000000000 +0100
@@ -258,7 +258,6 @@

                while (test_bit(TASKLET_STATE_SCHED, &t->state));
        }
        tasklet_unlock_wait(t);

- clear_bit(TASKLET_STATE_SCHED, &t->state);
}