linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/6] Convert all tasklets to workqueues
@ 2007-06-22  4:00 Steven Rostedt
  2007-06-22  4:00 ` [RFC PATCH 1/6] Convert the RCU tasklet into a softirq Steven Rostedt
                   ` (9 more replies)
  0 siblings, 10 replies; 129+ messages in thread
From: Steven Rostedt @ 2007-06-22  4:00 UTC (permalink / raw)
  To: LKML
  Cc: Linus Torvalds, Ingo Molnar, Andrew Morton, Thomas Gleixner,
	Christoph Hellwig, john stultz, Oleg Nesterov, Paul E. McKenney,
	Dipankar Sarma, David S. Miller, matthew.wilcox, kuznet


There's a very nice paper by Matthew Willcox that describes Softirqs,
Tasklets, Bottom Halves, Task Queues, Work Queues and Timers[1].
In the paper it describes the history of these items.  Softirqs and
tasklets were created to replace bottom halves after a company (Mindcraft)
showed that Microsoft on a 4x SMP box would out do Linux. It was discovered
that this was due to a bottle neck caused by the design of Bottom Halves.
So Alexey Kuznetsov and Dave Miller [1] (and I'm sure others) created
softirqs and tasklets to multithread the bottom halves.

This worked well, and for the time it shut-up Microsoft^WMindcraft from
saying Linux was slow at networking.

Time passed, and Linux developed other nifty tools, like kthreads and
work queues. These run in a process context and are not as menacing to
latencies as softirqs and tasklets are.  Specifically, a tasklet,
acts as a task by only being able to run the function on one CPU
at a time. The same tasklet can not run on multiple CPUS.  So in that
aspect it is like a task (a task can only exist on one CPU at a time).
But a tasklet is much harder on the rest of the system because it
runs in interrupt context.  This means that if a higher priority process
wants to run, it must wait for the tasklet to finish before doing so.

The most part, tasklets today are not used for time critical functions.
Running tasklets in thread context is not harmful to performance of
the overall system. But running them in interrupt context is, since
they increase the overall latency for high priority tasks.

Even in Matthew's paper, he says that work queues have replaced tasklets.
But this is not truly the case.  Tasklets are common and plentiful.
But to go and replace each driver that uses a tasklet with a work queue
would be very painful.

I've developed this way to replace all tasklets with work queues without
having to change all the drivers that use them.  I created an API that
uses the tasklet API as a wrapper to a work queue.  This API doesn't need
to be permanent. It shows 1) that work queues can replace tasklets, and
2) we can remove a duplicate functionality from the kernel.  This API
only needs to be around until we removed all uses of tasklets from
all drivers.

I just want to state that tasklets served their time well. But it's time
to give them an honorable discharge.  So lets get rid of tasklets and
given them a standing salute as they leave :-)


This patch series does the following:

1) Changes the RCU tasklet into a softirq. The RCU tasklet *is* a 
performance critical function, and changing it to a softirq gives it
even more performance, and removes overhead. This has already been done
in the RT kernel, and should be applied regardless of the rest of the
patches in the series.

2) Splits out the tasklets from softirq.c.  This too should be done anyways.
Tasklets are not softirqs, and they have their own semantics that they
deserve their own file. Also it makes it a lot cleaner to replace them
with something else :-)

3/4) Add an API to the tasklets to allow a driver to see if a tasklet
is scheduled.  The DRM driver does it's own little thing with tasklets
and reads into the internals of the tasklet. These patches give the
DRM driver an API to do that a little bit cleaner.

The above patches really should go into the kernel if for any other
reason as a clean up patch set.

5) Move tasklet.h to tasklet_softirq.h and have tasklet.h include it.

6) This is the magic to make tasklets into work queues. It allows for
the kernel to be configured either with the normal tasklets, as it is
today, or with the tasklets-as-work-queues.

I've booted these patches on 5 machines, i386 and x86_64, and when
I can get my powerbook loaded with Linux, I'll try it there too.

I'd like to give thanks to Ingo Molnar and Oleg Nesterov for reviewing 
my initial patch series and giving me some pointers.


[1] www.wil.cx/matthew/lca2003/paper.pdf

-- Steve

^ permalink raw reply	[flat|nested] 129+ messages in thread
* Re: [RFC PATCH 0/6] Convert all tasklets to workqueues
@ 2007-06-26 13:03 Clemens Ladisch
  2007-06-26 13:15 ` Takashi Iwai
  0 siblings, 1 reply; 129+ messages in thread
From: Clemens Ladisch @ 2007-06-26 13:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Takashi Iwai, Linus Torvalds, Steven Rostedt, LKML,
	Andrew Morton, Thomas Gleixner, Christoph Hellwig, john stultz,
	Oleg Nesterov, Paul E. McKenney, Dipankar Sarma, David S. Miller,
	matthew.wilcox, kuznet

Ingo Molnar wrote:
> so how about the following, different approach: anyone who has a tasklet
> in any performance-sensitive codepath, please yell now.

ALSA uses quite a few tasklets in the framework and in several  
drivers.  Since we
care very much about low latency, many places use tasklet_hi_*.

It would be possible to convert to some GENERIC_SOFTIRQ mechanism, but  
then we'd
want to use a softirq that has higher priority than the 'standard' generic
softirq, similar to HI_SOFTIRQ vs. TASKLET_SOFTIRQ.

BTW: Is there a reason why HRTIMER_SOFTIRQ is the lowest-priority  
softirq instead
of being near TIMER_SOFTIRQ?


Regards,
Clemens


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

end of thread, other threads:[~2007-06-30 11:25 UTC | newest]

Thread overview: 129+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-22  4:00 [RFC PATCH 0/6] Convert all tasklets to workqueues Steven Rostedt
2007-06-22  4:00 ` [RFC PATCH 1/6] Convert the RCU tasklet into a softirq Steven Rostedt
2007-06-22  7:10   ` Christoph Hellwig
2007-06-22  7:43     ` Ingo Molnar
2007-06-22 12:35       ` Steven Rostedt
2007-06-22 12:55         ` Ingo Molnar
2007-06-22  4:00 ` [RFC PATCH 2/6] Split out tasklets from softirq.c Steven Rostedt
2007-06-22  7:11   ` Christoph Hellwig
2007-06-22 12:40     ` Steven Rostedt
2007-06-22 13:45   ` Akinobu Mita
2007-06-22 13:58     ` Steven Rostedt
2007-06-22  4:00 ` [RFC PATCH 3/6] Add a tasklet is-scheduled API Steven Rostedt
2007-06-22  4:00 ` [RFC PATCH 4/6] Make DRM use the tasklet is-sched API Steven Rostedt
2007-06-22  6:36   ` Daniel Walker
2007-06-22  6:49     ` Thomas Gleixner
2007-06-22  7:08       ` Daniel Walker
2007-06-22 12:15         ` Steven Rostedt
2007-06-22 15:36           ` Daniel Walker
2007-06-22 22:38             ` Ingo Molnar
2007-06-22 23:28               ` Daniel Walker
2007-06-22 16:10       ` Arnd Bergmann
2007-06-22 16:56         ` Steven Rostedt
2007-06-22 18:24         ` Christoph Hellwig
2007-06-22 23:38           ` Dave Airlie
2007-06-22  4:00 ` [RFC PATCH 5/6] Move tasklet.h to tasklet_softirq.h Steven Rostedt
2007-06-22  4:00 ` [RFC PATCH 6/6] Convert tasklets to work queues Steven Rostedt
2007-06-22  7:06   ` Daniel Walker
2007-06-22 13:29     ` Steven Rostedt
2007-06-22 15:52       ` Oleg Nesterov
2007-06-22 16:35         ` Steven Rostedt
2007-06-23 11:15   ` Arnd Bergmann
2007-06-22  7:09 ` [RFC PATCH 0/6] Convert all tasklets to workqueues Christoph Hellwig
2007-06-22  7:51   ` Ingo Molnar
2007-06-22  7:53     ` Christoph Hellwig
2007-06-22 11:23       ` Ingo Molnar
2007-06-22 12:32   ` Steven Rostedt
2007-06-22 12:38     ` Ingo Molnar
2007-06-22 12:58       ` Steven Rostedt
2007-06-22 13:12         ` Ingo Molnar
2007-06-22 14:27           ` Steven Rostedt
2007-06-22 13:13         ` Andrew Morton
2007-06-22 13:26           ` Ingo Molnar
2007-06-22 13:41             ` Andrew Morton
2007-06-22 14:00               ` Ingo Molnar
2007-06-22 13:35           ` Steven Rostedt
2007-06-22 14:25 ` Arjan van de Ven
2007-06-22 14:42   ` Steven Rostedt
2007-06-22 14:43     ` Arjan van de Ven
2007-06-22 17:16 ` Linus Torvalds
2007-06-22 17:31   ` Steven Rostedt
2007-06-22 18:32   ` Christoph Hellwig
2007-06-22 20:40   ` Ingo Molnar
2007-06-22 21:00     ` Christoph Hellwig
2007-06-22 21:10       ` Ingo Molnar
2007-06-22 21:13       ` Thomas Gleixner
2007-06-22 21:37     ` Linus Torvalds
2007-06-22 21:59       ` Ingo Molnar
2007-06-22 22:09         ` Ingo Molnar
2007-06-22 22:43           ` Roland Dreier
2007-06-22 22:57             ` Alan Cox
2007-06-22 22:58         ` Steven Rostedt
2007-06-23  6:23         ` Dave Airlie
2007-06-24 15:16         ` Jonathan Corbet
2007-06-24 15:52           ` Steven Rostedt
2007-06-25 16:50           ` Tilman Schmidt
2007-06-25 17:06             ` Steven Rostedt
2007-06-25 20:50               ` Tilman Schmidt
2007-06-25 21:03                 ` Steven Rostedt
2007-06-25 19:52             ` Stephen Hemminger
2007-06-26  0:00           ` Jonathan Corbet
2007-06-26  0:52             ` Steven Rostedt
2007-06-25 18:48         ` Kristian Høgsberg
2007-06-25 19:11           ` Steven Rostedt
2007-06-25 20:07             ` Kristian Høgsberg
2007-06-25 20:31               ` Steven Rostedt
2007-06-25 21:08                 ` Kristian Høgsberg
2007-06-25 21:15           ` Ingo Molnar
2007-06-25 23:36             ` Stefan Richter
2007-06-26  0:46               ` Steven Rostedt
2007-06-26  1:46         ` Dan Williams
2007-06-26  2:01           ` Steven Rostedt
2007-06-26  2:12             ` Dan Williams
2007-06-28 12:37               ` Steven Rostedt
2007-06-28 16:37                 ` Oleg Nesterov
2007-06-28 18:02                 ` Dan Williams
2007-06-28 20:46                   ` Steven Rostedt
2007-06-28 21:23                     ` Dan Williams
2007-06-28 21:40                       ` Dan Williams
2007-06-28 22:01                         ` Steven Rostedt
2007-06-28 22:00                       ` Steven Rostedt
2007-06-28  5:48         ` Jeff Garzik
2007-06-28  9:23           ` Ingo Molnar
2007-06-28 14:38             ` Alexey Kuznetsov
2007-06-28 15:23               ` Jeff Garzik
2007-06-28 15:54               ` Steven Rostedt
2007-06-28 16:00               ` Ingo Molnar
2007-06-28 17:26                 ` Jeff Garzik
2007-06-28 17:44                 ` Jeff Garzik
2007-06-28 18:19                 ` Andrew Morton
2007-06-28 20:07                   ` Ingo Molnar
2007-06-29 11:34                 ` Alexey Kuznetsov
2007-06-29 11:48                   ` Duncan Sands
2007-06-29 13:36                     ` Alexey Kuznetsov
2007-06-29 14:01                       ` Duncan Sands
2007-06-29 16:34                         ` Alexey Kuznetsov
2007-06-29 12:29                   ` Ingo Molnar
2007-06-29 13:25                     ` Alexey Kuznetsov
2007-06-29 13:43                       ` Ingo Molnar
2007-06-29 15:23                         ` Alexey Kuznetsov
2007-06-29 13:41                   ` Steven Rostedt
2007-06-29 14:24                     ` Jeff Garzik
2007-06-29 14:26                     ` Oleg Nesterov
2007-06-29 19:04                       ` Alexey Kuznetsov
2007-06-29 14:27                     ` Alexey Kuznetsov
2007-06-29 15:51                   ` Oleg Nesterov
2007-06-29 16:21                     ` Alexey Kuznetsov
2007-06-29 16:52                       ` Oleg Nesterov
2007-06-29 17:09                         ` Oleg Nesterov
2007-06-30 11:25                           ` Oleg Nesterov
2007-06-28 15:17             ` Jeff Garzik
2007-06-22 21:53     ` Daniel Walker
2007-06-22 22:09       ` david
2007-06-22 22:15         ` Daniel Walker
2007-06-22 22:44           ` Ingo Molnar
2007-06-22 23:28             ` Daniel Walker
2007-06-22 22:15       ` Ingo Molnar
2007-06-23  5:14 ` Stephen Hemminger
2007-06-26 13:03 Clemens Ladisch
2007-06-26 13:15 ` Takashi Iwai

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).