Re: About tasklet and workqueue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



El Fri, Feb 13, 2009 at 11:04:17AM +0800 Peter Chen ha dit:

> I read the code about tasklet (softirq.c) and workqueue (workqueue.c),
> and there are two points I can't understand, Hope you can tell me why,
> and point out if i made any errors below.Thank you.
> 
> 1. Both tasklet and workqueue are created by kthread_create, it's
> default priority is the same, Usu, we want tasklet to run just after
> interrupt finished, but if their thread's priority is the same, how can
> we make sure tasklet was run before workqueue? 
> 
> 2. At the begin of workqueue running, it invokes:
> set_user_nice(current, -5);  to increase the its thread's priority.
> Then, if it was interrupted, and the interrupt schedules a tasklet.
> Sounds after interrupt returns, the workqueue will be invoked first.

the problem is your assumption that softirqs are only executed from
the ksoftirq kernel threads. pending softirqs (and in consequence
tasklets) are also processed on the exit from an interrupt handler
(see irq_exit() in kernel/softirq.c). this execution takes place in
the context of the interrupt and assures that the tasklet is executed
before the workqueue.

-- 
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona

                Don't walk behind me, I may not lead
             Don't walk in front of me, I may not follow
                Just walk beside me and be my friend
                          (Albert Camus)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux