All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: roger.larsson@e-gatan.se, linux-kernel@vger.kernel.org,
	mingo@elte.hu, rml@tech9.net, pavel@ucw.cz,
	netdev@vger.kernel.org
Subject: Re: PROBLEM: in_atomic() misuse all over the place
Date: Fri, 30 Jan 2009 16:03:16 -0800	[thread overview]
Message-ID: <20090130160316.7e53ef99.akpm@linux-foundation.org> (raw)
In-Reply-To: <87pri7k4id.fsf@basil.nowhere.org>

On Wed, 28 Jan 2009 13:18:50 +0100
Andi Kleen <andi@firstfloor.org> wrote:

> > file:  include/net/sock.h
> >
> >    static inline gfp_t gfp_any(void)
> >    {
> >      return in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
> >    }
> 
> That's typically for softirq vs non softirq, which is important
> for the network stack.
> 

There's a bit of a problem here.  If someone accidentally uses
gfp_any() inside a spinlock, it will do a sleeping allocation on
non-preempt kernels and will do an atomic allocation on preemptible
kernels, so we won't get to see the warning which would allow us to fix
the bug.

Would using irq_count() work?  If so, that would fix this up.

  reply	other threads:[~2009-01-31  0:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-27 23:10 PROBLEM: in_atomic() misuse all over the place Roger Larsson
2009-01-28  0:12 ` Robert Hancock
2009-01-31 11:45   ` Joerg Roedel
2009-01-28 12:18 ` Andi Kleen
2009-01-31  0:03   ` Andrew Morton [this message]
2009-01-31  5:55     ` Andi Kleen
2009-01-31  5:49       ` Andrew Morton
2009-01-31  8:48         ` David Miller
2009-01-31  8:58           ` Andrew Morton
2009-02-04 16:17 ` Pavel Machek

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=20090130160316.7e53ef99.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rml@tech9.net \
    --cc=roger.larsson@e-gatan.se \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.