Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux Kernel Preemption Levels

I'm wondering what the difference between PREEMPT_NONE and PREEMPT_VOLUNTARY are. According to the documentation,

This option reduces the latency of the kernel by adding more
"explicit preemption points" to the kernel code

But it does not mention what these points are. I tried googling it, but I didn't find any more details than the text above (which seems surprising, as I would think this would be a common question). My main concern is processes starving other processes, so I'm wondering if preemption occurs on timer interrupts with VOLUNTARY. Of course the more info the better, so I'm wondering what the other preemtion points might be.

like image 981
blackghost Avatar asked Oct 02 '22 12:10

blackghost


1 Answers

I believe this link to a mailing list has the answer.

Which is that might_sleep() and might_resched() become voluntary preemption points. Enabling PREEMPT_VOLUNTARY makes it call the function cond_resched().

And no, voluntary preemption does not occur on interrupts. That would be full preemption, which checks on each interrupt and if the kernel not flagged to block preemption, it switches to the highest priority task.

like image 90
Zan Lynx Avatar answered Oct 13 '22 10:10

Zan Lynx