All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Quade <quade@hsnr.de>
To: linux-kernel@vger.kernel.org
Cc: quade@hs-niederrhein.de
Subject: tasklet_kill: bug or feature?
Date: Sat, 14 Dec 2002 21:16:37 +0100	[thread overview]
Message-ID: <20021214201637.GA3073@hsnr.de> (raw)

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

                 reply	other threads:[~2002-12-14 20:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021214201637.GA3073@hsnr.de \
    --to=quade@hsnr.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quade@hs-niederrhein.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.