public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* tasklets and finalization
@ 2001-11-11 14:34 Duncan Sands
  0 siblings, 0 replies; 4+ messages in thread
From: Duncan Sands @ 2001-11-11 14:34 UTC (permalink / raw)
  To: linux-kernel

Hi!  In the driver I'm working on, a tasklet is scheduled
from time to time.  Are there any guarantees as to when
it will run?  I'm worried, for example, about module
unloading: how to be sure that the scheduled tasklet runs
before the module is unloaded?

Thanks,

Duncan.

PS: My first thought was to use tasklet_kill, but according
to "Linux device drivers" (2nd ed) that may hang if the
tasklet isn't pending.

PPS: Another thought was to call schedule(), hoping that
all pending asklets will get run then, but is that reliable?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: tasklets and finalization
       [not found] <XFMail.20011112085704.mathijs@knoware.nl>
@ 2001-11-12  8:21 ` Duncan Sands
  2001-11-12  8:35   ` Mathijs Mohlmann
  0 siblings, 1 reply; 4+ messages in thread
From: Duncan Sands @ 2001-11-12  8:21 UTC (permalink / raw)
  To: Mathijs Mohlmann; +Cc: linux-kernel

On Monday 12 November 2001 8:57 am, you wrote:
> On 11-Nov-2001 Duncan Sands wrote:
> > PS: My first thought was to use tasklet_kill, but according
> > to "Linux device drivers" (2nd ed) that may hang if the
> > tasklet isn't pending.
>
> true.
>
> > PPS: Another thought was to call schedule(), hoping that
> > all pending asklets will get run then, but is that reliable?
>
> if you are sure, the tasklet isn't rescheduled within the tasklet
> i THINK this will do it:
>
>         current->policy |= SCHED_YIELD;
>         schedule();
>
>         me

Thanks for thinking about this.  Here's a thought:

...
tasklet_schedule(&my_tasklet);
tasklet_kill(&my_tasklet);
...

Since (as far as I can see) there is no way the
tasklet will run before calling tasklet_kill, this
should just kill any pending tasklets.

Duncan.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: tasklets and finalization
  2001-11-12  8:21 ` tasklets and finalization Duncan Sands
@ 2001-11-12  8:35   ` Mathijs Mohlmann
  2001-11-12  8:41     ` Duncan Sands
  0 siblings, 1 reply; 4+ messages in thread
From: Mathijs Mohlmann @ 2001-11-12  8:35 UTC (permalink / raw)
  To: Duncan Sands; +Cc: linux-kernel, Mathijs Mohlmann


On 12-Nov-2001 Duncan Sands wrote:
> ...
> tasklet_schedule(&my_tasklet);
> tasklet_kill(&my_tasklet);
> ...
> 
> Since (as far as I can see) there is no way the
> tasklet will run before calling tasklet_kill, this
> should just kill any pending tasklets.

cpu#1           cpu#2
tasklet_schedule
                tasklet_schedule
run tasklet
                tasklet_kill
                loop


-- 
        me

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: tasklets and finalization
  2001-11-12  8:35   ` Mathijs Mohlmann
@ 2001-11-12  8:41     ` Duncan Sands
  0 siblings, 0 replies; 4+ messages in thread
From: Duncan Sands @ 2001-11-12  8:41 UTC (permalink / raw)
  To: Mathijs Mohlmann; +Cc: linux-kernel

On Monday 12 November 2001 9:35 am, Mathijs Mohlmann wrote:
> On 12-Nov-2001 Duncan Sands wrote:
> > ...
> > tasklet_schedule(&my_tasklet);
> > tasklet_kill(&my_tasklet);
> > ...
> >
> > Since (as far as I can see) there is no way the
> > tasklet will run before calling tasklet_kill, this
> > should just kill any pending tasklets.
>
> cpu#1           cpu#2
> tasklet_schedule
>                 tasklet_schedule
> run tasklet
>                 tasklet_kill
>                 loop

Aaargh!  I should think before typing.  It is too
early in the morning here...

Duncan.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-11-12  8:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <XFMail.20011112085704.mathijs@knoware.nl>
2001-11-12  8:21 ` tasklets and finalization Duncan Sands
2001-11-12  8:35   ` Mathijs Mohlmann
2001-11-12  8:41     ` Duncan Sands
2001-11-11 14:34 Duncan Sands

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox