[PATCH] small bugfix to tasklet_kill

Juergen Quade (quade@hsnr.de)
Sun, 12 Jan 2003 10:45:45 +0100


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);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/