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

From: Blaisorblade
Date: Wed Jan 18 2006 - 06:46:15 EST


On Wednesday 18 January 2006 01:56, Andrew Morton wrote:
> "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.

Yes, I know.

But is libc supposed too? That's our problem. This code is only used for calls
to malloc() (not kmalloc()) after the kernel has booted.

There are a few calls to malloc in our code, ok, and those should be fixed
too.

But the main problem are glibc ones (which are called from all kinds of places
- we once got a crash because opendir() was calling malloc with big sizes -
we solved that by optionally using vmalloc()).
--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade


___________________________________
Yahoo! Messenger with Voice: chiama da PC a telefono a tariffe esclusive
http://it.messenger.yahoo.com
-
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/