File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 2121#define NO_GPIO_REQUEST_ARRAY
2222#endif
2323
24- /* Macro DECLARE_TASKLET_OLD exists for compatibility.
25- * See https://lwn.net/Articles/830964/
26- */
27- #ifndef DECLARE_TASKLET_OLD
28- #define DECLARE_TASKLET_OLD (arg1 , arg2 ) DECLARE_TASKLET(arg1, arg2, 0L)
29- #endif
30-
3124static int button_irqs [] = { -1 , -1 };
3225
3326/* Define GPIOs for LEDs.
Original file line number Diff line number Diff line change @@ -2107,11 +2107,21 @@ \subsection{Detecting button presses}
21072107\subsection {Bottom Half }
21082108\label {sec:bottom_half }
21092109Suppose you want to do a bunch of stuff inside of an interrupt routine.
2110- A common way to do that without rendering the interrupt unavailable for a significant duration is to combine it with a tasklet.
2110+ A common way to avoid blocking the interrupt for a significant duration
2111+ is to defer the time-consuming part to a workqueue.
21112112This pushes the bulk of the work off into the scheduler.
2112-
2113- The example below modifies the previous example to also run an additional task when an interrupt is triggered.
2114-
2113+ This approach helps speed up the interrupt handling process itself,
2114+ allowing the system to respond to the next hardware interrupt more quickly.
2115+
2116+ Kernel developers generally discourage using tasklets due to their design limitations,
2117+ such as memory management issues and unpredictable latencies.
2118+ Instead, they recommend more robust mechanisms like workqueues or \textbf {softirqs }.
2119+ To address tasklet shortcomings, Linux contributors introduced the BH workqueue,
2120+ activated with the \cpp |WQ_BH| flag.
2121+ This workqueue retains critical features,
2122+ such as execution in atomic (\textbf {softirq }) context on the same CPU and the inability to sleep.
2123+
2124+ The example below extends the previous code to include an additional task executed in process context when an interrupt is triggered.
21152125\samplec {examples/bottomhalf.c}
21162126
21172127\subsection {Threaded IRQ }
You can’t perform that action at this time.
0 commit comments