Re: [PATCH] Linux 2.6.0-test8 __might_sleep warnings on boot

From: Andrew Morton
Date: Sat Oct 18 2003 - 19:22:50 EST


Roland Dreier <roland@xxxxxxxxxxxxxxxxxx> wrote:
>
> if (system_running)
> cachep = (kmem_cache_t *) kmem_cache_alloc(&cache_cache, SLAB_KERNEL);
> else
> cachep = (kmem_cache_t *) kmem_cache_alloc(&cache_cache, SLAB_ATOMIC);
>

I've already done this; didn't like it.

> if (system_running)
> acquire_console_sem();
>
> /* ... */
>
> if (system_running)
> release_console_sem();

Ditto.

> --- linux-2.6.0-test8/kernel/sched.c~early_might_sleep Sat Oct 18 11:54:24 2003
> +++ linux-2.6.0-test8/kernel/sched.c Sat Oct 18 16:44:14 2003
> @@ -2847,8 +2847,12 @@ void __might_sleep(char *file, int line)
> {
> #if defined(in_atomic)
> static unsigned long prev_jiffy; /* ratelimiting */
> + extern int system_running;
>
> - if (in_atomic() || irqs_disabled()) {
> + /* Don't print warnings until system_running is set. This avoids
> + spurious warnings during boot before local_irq_enable() and
> + init_idle(). */
> + if (system_running && (in_atomic() || irqs_disabled())) {
> if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
> return;
> prev_jiffy = jiffies;

And ditto. (Except declarations go in .h files, not in .c files).

Sigh. We may as well use this approach I guess.

-
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/