Re: [PATCH 6/9] uml: avoid malloc to sleep in atomic sections

From: Andrew Morton
Date: Tue Jan 17 2006 - 19:52:38 EST


"Paolo 'Blaisorblade' Giarrusso" <blaisorblade@xxxxxxxx> wrote:
>
> +int __cant_sleep(void) {
> + return in_atomic() || irqs_disabled() || in_interrupt();

aww, man, this is awful. Code is supposed to know what context it's
running in, not go fishing about in core internals trying to fix up its own
confusion.

> + /* Is in_interrupt() really needed? */
> }

Yes, it is. in_atomic() is a no-op on !PREEMPT and local irq's can be
enabled in soft- or hard- interrupt context, so irqs_disabled() will return
0.
-
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/