2005-05-29 14:29:14

by Manoj Sharma

[permalink] [raw]
Subject: Is wake_up safe on 2.4?

Hi,

Is it safe to use wake_up() in 2.4 inside an interrupt handler or in a
spin lock region?

wake_up() uses reshedule_idle() to find an idle cpu for the woken up
task. If it doesn't find any, it checks the current running tasks on all
CPUs and uses goodness value to pick up the best cpu to schedule the
woken up task. Isn't possible to preempt the current task where
reschedule_idle() is running?

There are plenty of instances in the kernel (2.4) where wake_up() is
being used inside interrupt handler or after taking spin locks. If it
can preempt the task calling wake_up(), how safe is it to use then?



Manoj



2005-05-29 15:15:56

by Parag Warudkar

[permalink] [raw]
Subject: Re: Is wake_up safe on 2.4?

On Sunday 29 May 2005 10:28, [email protected] wrote:
> Is it safe to use wake_up() in 2.4 inside an interrupt handler or in a
> spin lock region?
>
> wake_up() uses reshedule_idle() to find an idle cpu for the woken up
> task. If it doesn't find any, it checks the current running tasks on all
> CPUs and uses goodness value to pick up the best cpu to schedule the
> woken up task. ?Isn't possible to preempt the current task where
> reschedule_idle() is running?
>
> There are plenty of instances in the kernel (2.4) where wake_up() is
> being used inside interrupt handler or after taking spin locks. If it
> can preempt the task calling wake_up(), how safe is it to use then?

Looking at the code - On SMP, the woken up task will be always scheduled on a
CPU other than the one executing the caller, in which case caller of
wake_up() is not pre-empted. On UP, it just sets need_resched (different than
calling schedule() ) in which case the caller of wake_up() will be
rescheduled only when appropriate, when it is safe to preempt it.