lkml.org 
[lkml]   [2003]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC] 2.5 TASK_INTERRUPTIBLE preemption race
From
Date
On Mon, 2003-04-14 at 17:54, Joe Korty wrote:

> Is this analysis correct? If it is, perhaps there is an alternative
> to fixing these cases individually: make the TASK_INTERRUPTIBLE/
> TASK_UNINTERRUPTIBLE states block preemption. In which case the
> 'set_current_state(TASK_RUNNING)' macro would need to include the
> same preemption check as 'preemption_enable'.

Thankfully you are wrong or we would have some serious problems :)

See kernel/sched.c :: preempt_schedule() where we set p->preempt_count
to PREEMPT_ACTIVE.

Then see kernel/sched.c :: schedule() where we short-circuit the
remove-from-runqueue code if PREEMPT_ACTIVE is set.

Thus, it is safe to preempt regardless of the task's state. It will
eventually reschedule.

Robert Love

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:34    [W:0.059 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site