Re: [linux-audio-dev] Re: [announce] [patch] Voluntary KernelPreemption Patch

From: Andrew Morton
Date: Tue Jul 13 2004 - 17:27:21 EST


Andrea Arcangeli <andrea@xxxxxxx> wrote:
>
> > Sleeping with local interrupts disabled is usually a bug, so we should
> > prefer to keep that check in might_sleep().
>
> either it's _always_ a bug including for entry.S or sched_yield, or it's
> _never_ a bug. I don't understand the "usually".

If some code does:


local_irq_disable();
<fiddle with per-cpu stuff>
kmalloc(GFP_KERNEL);
<fiddle with per-cpu stuff>
local_irq_enable();

or

local_irq_disable();
<fiddle with per-cpu stuff>
function_which_calls_cond_resched();
<fiddle with per-cpu stuff>
local_irq_enable();

then we want might_sleep() to warn about the bug.

The fact that a couple of scheduler-internal fastpaths happen to know that
they can call schedule() with interrupts disabled is not relevant to this.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/