From: Stephen S. <st...@st...> - 2005-12-14 21:20:13
|
On Wed, 2005-12-14 at 22:41 +0300, Vitaly Wool wrote: > >Is this really true? Is tasklet scheduling "harder" than kernal thread > >scheduling? A close look at my PXA SSP SPI implementation will reveal > >that my design is nearly lock-less and callable from any execution > >context (i.e. interrupt context). > > > > > It's harder in your case because the tasklet is created each time it's > scheduled again, as far as I see it in your impleemntation. > Each SPI controller thread is created only once so it's more lightweight > than what you do. > I'm not sure what you mean by "create". The tasklet structures are created and initialized once in the driver probe function. I'm not an expert but I looked into the implementation (softirq.c) of tasklets and found the following design: 1) Tasklets are run by a softirq. 2) A softirq is really a kernel thread allocated on a per cpu basis. 3) A "scheduled" tasklet is simply a member of a link list maintained by the softirq thread. My driver implementation has the following features: 1) Uses only one kernel thread for all SPI controllers. 2) Reuses existing performance tuned kernel infrastructure (i.e. tasklets) 3) Implements a low latency locking scheme for dispatching SPI transfers via tasklet's serial scheduling guarantees. IMHO, from a system load perspective, my approach is lighter and simpler than adding a dedicated kernel thread for each SPI controller. Stephen |