All of lore.kernel.org
 help / color / mirror / Atom feed
* tasklet_kill: bug or feature?
@ 2002-12-14 20:16 Juergen Quade
  0 siblings, 0 replies; only message in thread
From: Juergen Quade @ 2002-12-14 20:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: quade

Hi,

I had a closer look to the tasklet implementation, especially
to tasklet_kill. I do not understand, why at the end of
the function the TASKLET_STATE_SCHED bit is cleared. Is it
a bug or a feature? Maybe someone can help me.

	The function tasklet_schedule does two things:
	1. it sets the schedule_bit (TASKLET_STATE_SCHED)
	2. if the bit wasn't set (cleared) it puts the tasklet on the
	   tasklet_vec list.
	
	By the trick, to set the schedule_bit without putting
	the tasklet on the list, a tasklet can be "killed"
	(it is not on the list and tasklet_schedule is not going
	to put it on the list). But in the current implementation
	of tasklet_kill the schedule_bit is cleared (last line of
	the function)? In this case the next tasklet_schedule
	"works" and the tasklet-function will be called again.
	So, is it a bug? What do we achieve by clearing the
	schedule_bit? Can we remove the "clear_bit" line
	(it is not necessary to call "set_bit", because
	"test_and_set_bit" has set it before)?
	Or what is _exactly_ the purpose of tasklet_kill?

	Juergen.

=====================
void tasklet_kill(struct tasklet_struct *t)
{
	if (in_interrupt())
		printk("Attempt to kill tasklet from interrupt\n");

	while (test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) {
		do
			yield();
		while (test_bit(TASKLET_STATE_SCHED, &t->state));
	}
	tasklet_unlock_wait(t);
	clear_bit(TASKLET_STATE_SCHED, &t->state);
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-14 20:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-14 20:16 tasklet_kill: bug or feature? Juergen Quade

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.