Re: [PATCH] misc. kernel preemption bits

Andrew Morton (akpm@zip.com.au)
Thu, 29 Aug 2002 11:24:21 -0700


Robert Love wrote:
>
> ...
> - we have a debug check in preempt_schedule that, even
> on detecting a schedule with irqs disabled, still goes
> ahead and reschedules. We should return. (me)
>

OK, but that warning will still come out of the mess in mm/slab.c.

Reminder:

CPU0: CPU1:
local_irq_disable(); resched_task(task on CPU0)
spin_lock();
... p->need_resched = 1;
spin_unlock(); // reschedules
local_irq_enable();

There is one code path in slab which fixes this with _raw_spin_unlock()
and a subsequent preempt_disable(), but there are quite a lot of other
code paths which need the same treatment. Fixing them is messy.

So unless you guys hit me with a brick, I'll create:

#ifdef CONFIG_SMP
#define preempt_disable_irqsave(flags)
do {
preempt_disable();
local_irq_save(flags);
} while (0)
#define preempt_enable_irqrestore(flags)
do {
local_irq_restore(flags);
preempt_enable();
} while (0)
#else
#define preempt_disable_irqsave(flags)
do {
local_irq_save(flags);
} while (0)
#define preempt_enable_irqrestore(flags)
do {
local_irq_restore(flags);
} while (0)
#endif

and use that in slab.
-
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/