mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Roland Dreier <roland@digitalvampire.org>
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Linux 2.6.0-test8 __might_sleep warnings on boot
Date: Sat, 18 Oct 2003 17:21:40 -0700	[thread overview]
Message-ID: <20031018172140.4968e273.akpm@osdl.org> (raw)
In-Reply-To: <87d6cuozm7.fsf@love-shack.home.digitalvampire.org>

Roland Dreier <roland@digitalvampire.org> 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.


  reply	other threads:[~2003-10-19  0:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-18 21:38 Roland Dreier
2003-10-18 23:14 ` Andrew Morton
2003-10-19  0:11   ` Roland Dreier
2003-10-19  0:21     ` Andrew Morton [this message]
2003-10-19  1:19       ` Roland Dreier
2003-10-19  1:53         ` Jesper Juhl
2003-10-19 19:17           ` Roland Dreier
2003-10-20  8:28             ` Jesper Juhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031018172140.4968e273.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@digitalvampire.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®