On Mon, Oct 12, 2009 at 11:24 AM, Joel Fernandes <[email protected]> wrote:
> Hi Friends,
>
> I have a question about tasklets:
>
> I understand that they are used to defer work during interrupt
> handling. What I don't understand is - how do they handle queuing of
> deferred work?
> Specially with tasklets, if a tasklet is re-scheduled before the
> previous scheduling of the same tasklet has a chance to run, then the
> tasklet is executed only once - not twice. But what if the work that
> the tasklet was supposed to do in these 2 instances were different and
> that its function was supposed to be passed 2 different structures?
> Shouldn't the tasklet be executed twice with these 2 structures?
>
> I know that work queues are there for that, but how do device drivers
> that use tasklets cope with the above?

One thing that I can suggest is to pass those data structures as
linked list together with something like "already_done" flag. So, if a
tasklest is already done with single data, mark it, then move onto
next data.

It would be  better to use atomic_t as flag's type, since IMO there is
a chance a race condition happen to toggle this flag.

Alternative:use head pointer to mark next data target. Again, setting
head pointer should be done atomically.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to