linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@mandrakesoft.com>
To: Ville Nummela <ville.nummela@mail.necsom.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Andrea Arcangeli <andrea@suse.de>,
	Linus Torvalds <torvalds@transmeta.com>
Subject: Re: tasklets in 2.4.6
Date: Fri, 06 Jul 2001 03:08:05 -0400	[thread overview]
Message-ID: <3B4563D5.89A1ACA3@mandrakesoft.com> (raw)
In-Reply-To: <7an16iy2wa.fsf@necsom.com>

Ville Nummela wrote:
> In kernel/softirq.c, line 178:
> 
>                 if (test_bit(TASKLET_STATE_SCHED, &t->state))
>                         tasklet_schedule(t);
> 
> What's the idea behind this line? If the tasklet is already scheduled,
> schedule it again? This does not make much sense to me.
> 
> Also, few lines before:
> 
>                        if (test_bit(TASKLET_STATE_SCHED, &t->state))
>                                 goto repeat;
> 
> Here we'll loop forever if the tasklet should schedule itself.

hmmm, it looks almost ok to me.

The tasklet is locked before the "repeat" label, so any tasklet
scheduling itself will set the bit, but NOT actually schedule iteself. 
For this see the tasket_schedule code, for the case where the bit is not
set, but the tasklet is locked.

The first statement above schedules the tasklet if the bit was set while
the tasklet was locked.  The second statement, as the comment right
above it indicates, causes the tasklet to repeat itself.

The only thing that appears fishy is that if the tasklet constantly
reschedules itself, it will never leave the loop AFAICS.  This affects
tasklet_hi_action as well as tasklet_action.

> repeat:
>                 if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state))
>                         BUG();
>                 if (!atomic_read(&t->count)) {
>                         local_irq_enable();
>                         t->func(t->data);
>                         local_irq_disable();
>                         /*
>                          * One more run if the tasklet got reactivated:
>                          */
>                         if (test_bit(TASKLET_STATE_SCHED, &t->state))
>                                 goto repeat;
>                 }


	Jeff


-- 
Jeff Garzik      | A recent study has shown that too much soup
Building 1024    | can cause malaise in laboratory mice.
MandrakeSoft     |

  reply	other threads:[~2001-07-06  7:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-06  6:42 tasklets in 2.4.6 Ville Nummela
2001-07-06  7:08 ` Jeff Garzik [this message]
2001-07-06  8:25   ` Jeff Garzik
2001-07-06  8:27     ` Jeff Garzik
2001-07-06 11:57     ` Andrea Arcangeli
2001-07-06 12:07       ` Jeff Garzik
2001-07-09  9:09     ` Ville Nummela
2001-07-09 11:39       ` Ville Nummela
2001-07-09 14:24         ` Andrea Arcangeli
2001-07-06 11:28   ` Andrea Arcangeli

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=3B4563D5.89A1ACA3@mandrakesoft.com \
    --to=jgarzik@mandrakesoft.com \
    --cc=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@transmeta.com \
    --cc=ville.nummela@mail.necsom.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).