Let's start by explaining why the kernel divides interrupts into the upper and lower parts
Because the interrupt itself interrupts normal program execution, task scheduling cannot be performed in the interrupt, so the interrupt needs to be returned quickly, but some operations must be performed in the interrupt.
If the kernel needs to perform a hardware-related, time-sensitive, cannot be interrupted operation, then these operations should be placed in the top half, the other can postpone the operation should be placed in the lower part, so that the interruption must be completed in the operation, but also good scheduling.
Look at the kernel's support for the bottom half.
First say the following how to add your own soft interrupt program
First add your own soft break type, the lower the value the higher the priority
Using OPEN_SOFTIRQ to increase the corresponding interrupt processing function
Use RAISE_SOFTIRQ to interrupt your software effectively
The kernel will then be able to invoke the software interrupt in DO_SOFTIRQ.
And look at Tasklet.
Use the above 3 methods to declare your Tasklet
Of course to write your own execution function void func (unsigned long arg);
Add your own tasklet to the schedule with the above two functions
Of course there are corresponding functions to cancel their own tasklet, here does not introduce
Next look at the work queue Workqueue
The above method can be used to declare a work
Of course you have to write your own execution function
Use the above method to add work to the system Workquene
Of course, you can create your own work queue, and then join the work in your own working queue
The Linux kernel is interrupting the lower half of the