All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Andi Kleen <andi@firstfloor.org>
Subject: Re: [patch 1/2] net: don't use in_atomic() in gfp_any()
Date: Wed, 11 Feb 2009 13:49:42 -0800	[thread overview]
Message-ID: <20090211134942.a800067e.akpm@linux-foundation.org> (raw)
In-Reply-To: <200902120638.BFG12928.FFMOHJOVtOQLFS@I-love.SAKURA.ne.jp>

Resend with cc's restored.  Please DO NOT edit the Cc: line :(

On Thu, 12 Feb 2009 06:38:55 +0900
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> wrote:

> Andrew Morton wrote:
> > Solve both these problems by switching to in_interrupt().  Now, if someone
> > runs a gfp_any() allocation from inside spinlock we will get the warning
> > if CONFIG_PREEMPT=y.
> 
> >  static inline gfp_t gfp_any(void)
> >  {
> > -	return in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
> > +	return in_softirq() ? GFP_ATOMIC : GFP_KERNEL;
> >  }
> sed -i -e 's/in_softirq/in_interrupt/' ?

heh, good question.

I did all my testing with in_softirq() - the changelog didn't catch up.



Is gfp_any() supposed to be usable from hardirq context?

If so, we should use in_interrupt().

If not, we should use in_softirq(), and we'll then get might_sleep()
warnings if anyone uses gfp_any() from hard irq context.





  parent reply	other threads:[~2009-02-11 21:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-11 21:27 [patch 1/2] net: don't use in_atomic() in gfp_any() akpm
2009-02-11 21:38 ` Tetsuo Handa
2009-02-11 21:48   ` Andrew Morton
2009-02-11 22:02     ` David Miller
2009-02-11 21:49   ` Andrew Morton [this message]
2009-02-13  0:43 ` David Miller

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=20090211134942.a800067e.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /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.