Difference between SoftIRQs and Tasklets?

I got this answer while googling..hope this explains your doubt.

Up vote 1 down vote favorite 1 share g+ share fb share tw.

While studying Linux interrupt handling I found that Tasklets and SoftIRQs are two different methods of performing "bottom half" (lesser priority work). I understand this (quite genuine need). Difference being, SoftIRQs are re-entarant while a Tasklet is NOT.

That same SoftIRQ can run on different CPUs while this is NOT the case with Tasklets. Though I understand this from surface but I fail in understanding the requirements of the two features. In what case(s) we may use these facilities?

How to recognize that I should use Tasklets now and SoftIRQs then. Also what do we mean by Tasklets are made upon SoftIRQs? In one of the books I read in LKML there were debates upon removing Tasklets.

I got completely confused why one would bring in such a feature? Some shortsightedness (No offense meant)? Any pointers on this will help a lot.

Thanks for your time :) Ripunjay Tripathi interrupt-handling link|improve this question edited Aug 28 '11 at 7:34 asked Aug 21 '11 at 8:25RIPUNJAY TRIPATHI19111 83% accept rate.

I got this answer while googling..hope this explains your doubt. Softirqs and tasklets replaced bottom halves, because bottom halves were a large bottle neck on SMP systems. If a bottom half was running on one CPU no other bottom halves could run on any other CPU.

It's obvious how these wouldn't scale. Softirqs and tasklets replaced bottom halves. The difference between softirqs and tasklets, is that a softirq is guaranteed to run on the CPU it was scheduled on, where as tasklets don't have that guarantee.

Also the same tasklet can not run on two separate CPUS at the same time, where as a softirq can. Don't confuse the tasklet restriction with that of the bottom halves. Two different tasklets can run on two different CPUs, just not the same one.

Now to answer your question. I can't argue why we have tasklets (I'm trying to get rid of them ;-) but I'll give the best example of why we have softirqs. That's the networking code.

Say you get a network packet. But to process that packet, it takes a lot of work. If you do that in the interrupt handler, no other interrupts can happen on that IRQ line.

That would cause a large latency to incoming interrupts and perhaps you'll overflow the buffers and drop packets. So the interrupt handler only moves the data off to a network receive queue, and returns. But this packet still needs to be processed right away.

Before anything else. So it goes off to a softirq for processing. Now you still allow for interrupts to come in.

Perhaps the network interrupt comes in again on another CPU. The other CPU can start processing that packet with a softirq on that CPU, even before the first packet was done processing. See how this can scale well?

But the same tasklet can't run on two different CPUs, so it doesn'h have this advantage. In fact if a tasklet is scheduled to run on another CPU but is waiting for other tasklets to finish, and you try to schedule the tasklet on a CPU that's not currently processing tasklets, it will notice that the tasklet is already scheduled to run and not do anything. So tasklets are not so reliable when it comes to latencies.

Hence, why I'm working on getting rid of them, since I don't beleive they accomplish what people think they do.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions