Re: question about spin_lock_irqsave

Artur Skawina (skawina@geocities.com)
Mon, 27 Dec 1999 17:57:57 +0100


mathijs wrote:
>
> I noticed something "funny". In wake_up_process (kernel/sched.c
> line 324, 2.3.34) reschedule_idle is called after doing a
> spin_lock_irqsave. In reschedule_idle, every exit has an spin_unlock_irqrestore.
> Except when the kernel is compiled without __SMP__. In this case, no unlock is
> preformed.
>
> Will this not leak on the stack? What am i missing?

it won't leak as in the UP case it only restores the flags, but it might
delay servicing interrupts unnecessarily. The obvious patch would be:

diff -urNp /img/linux-2.3.34/kernel/sched.c linux-2.3.34as/kernel/sched.c
--- /img/linux-2.3.34/kernel/sched.c Wed Dec 15 07:33:33 1999
+++ linux-2.3.34as/kernel/sched.c Mon Dec 27 16:05:30 1999
@@ -273,6 +261,7 @@ send_now:
tsk = cpu_curr(this_cpu);
if (preemption_goodness(tsk, p, this_cpu) > 0)
tsk->need_resched = 1;
+ spin_unlock_irqrestore(&runqueue_lock, flags);
#endif
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/