naah. preempt() means preempt. But the implementation
is in fact maybe_preempt(), or preempt_if_needed().
I use (verbosely) (simplified):
#define conditional_schedule_needed() unlikely(current->need_resched)
#define unconditional_schedule() do {
__set_current_state(TASK_RUNNING)
schedule();
} while(0);
#define conditional_schedule() if (conditional_schedule_needed())
unconditional_schedule();
...
foo()
{
...
conditional_schedule();
...
}
bar()
{
...
if (conditional_schedule_needed()) {
spin_unlock(&piggy_lock);
unconditional_schedule();
spin_lock(&piggy_lock);
goto clean_up_mess;
}
...
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/