I am looking at scheduler code in Linux:
if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
if (unlikely(signal_pending_state(prev->state, prev))) {
prev->state = TASK_RUNNING;
} else {
deactivate_task(rq, prev, DEQUEUE_SLEEP);
prev->on_rq = 0;
As I understand, if the prev
task is uninterruptible, this code will deactivate the task (and remove from runqueue) provided
preempt_count() & PREEMPT_ACTIVE == 0
Can someone explain to me what is preempt_count
in thread_info
for and when will this condition met or not?