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 21
21
#define NO_GPIO_REQUEST_ARRAY
22
22
#endif
23
23
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
-
31
24
static int button_irqs [] = { -1 , -1 };
32
25
33
26
/* Define GPIOs for LEDs.
Original file line number Diff line number Diff line change @@ -2107,11 +2107,21 @@ \subsection{Detecting button presses}
2107
2107
\subsection {Bottom Half }
2108
2108
\label {sec:bottom_half }
2109
2109
Suppose 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.
2111
2112
This 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.
2115
2125
\samplec {examples/bottomhalf.c}
2116
2126
2117
2127
\subsection {Threaded IRQ }
You can’t perform that action at this time.
0 commit comments