When the Linux kernel prints "bug:scheduling while Atomic" and "bad:scheduling from the Idle thread" error,
It is usually called in the interrupt handler function that can sleep, such as semaphore,mutex,sleep, such as a dormant function,
While the Linux kernel requires interrupt processing, the system is not allowed to dispatch, not allow preemption, wait until the completion of the interrupt processing to do other things.
Therefore, to fully consider the interruption of processing time, must not be too long.
Another thing that can create this problem is that in the idle process, you do what you shouldn't. Linux is now used in many handheld devices, in order to reduce power consumption,
The usual practice is to reduce the CPU or RAM frequency, turn off some devices, and so on in the idle process. To ensure that the atomic nature of these actions
The "bad:scheduling from the idle thread" error does not occur!
Banning kernel preemption means that the kernel does not proactively preempt your process, but now you are actively call schedule () in your own program,
Kernel can't stop you from doing this.