linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh.dickins@tiscali.co.uk>
To: Jan Beulich <JBeulich@novell.com>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] adjust gfp mask passed on nested vmalloc()  invocation
Date: Wed, 7 Oct 2009 13:08:17 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0910071300330.28844@sister.anvils> (raw)
In-Reply-To: <4ACC62DC0200007800018690@vpn.id2.novell.com>

On Wed, 7 Oct 2009, Jan Beulich wrote:
> >>> Hugh Dickins <hugh.dickins@tiscali.co.uk> 06.10.09 23:58 >>>
> >On Mon, 5 Oct 2009, Jan Beulich wrote:
> >
> >> - fix a latent bug resulting from blindly or-ing in __GFP_ZERO, since
> >>   the combination of this and __GFP_HIGHMEM (possibly passed into the
> >>   function) is forbidden in interrupt context
> >> - avoid wasting more precious resources (DMA or DMA32 pools), when
> >>   being called through vmalloc_32{,_user}()
> >> - explicitly allow using high memory here even if the outer allocation
> >>   request doesn't allow it, unless is collides with __GFP_ZERO
> >> 
> >> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> >
> >I thought vmalloc.c was a BUG_ON(in_interrupt()) zone?
> >The locking is all spin_lock stuff, not spin_lock_irq stuff.
> >That's probably why your "bug" has remained "latent".
> 
> Then you probably mean BUG_ON(irqs_disabled()), which would seem
> correct.

I'm relieved you came to see that remark as bogus.

> But if the gfp mask massaging was needed for calling kmalloc(),
> it would seem odd that the same shouldn't be needed for calling
> vmalloc() recursively...
> 
> >Using HIGHMEM for internal arrays looks reasonable to me; but if
> >__GFP_ZERO were a problem, wouldn't it be much cleaner to skip the
> >"unless it collides" and #ifdef CONFIG_HIGHMEM !in_interrupt() stuff,
> >just memset the array returned from __vmalloc_node()?
> 
> The main goal was to change the existing code as little as possible - I
> did consider this alternative, but wasn't sure that would be accepted.
> If you view this as the better alternative, I'll certainly modify the
> patch to do it that way.

Well, now we've accepted that this code cannot be used in_interrupt(),
there's no need for your #ifdef CONFIG_HIGHMEM nor for my memset: just
use __GFP_ZERO as it was before, and your patch would amount to or'ing
__GFP_HIGHMEM into gfp_mask for the __vmalloc_node case - wouldn't it?

Hugh

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2009-10-07 12:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-05 10:16 Jan Beulich
2009-10-06 21:58 ` Hugh Dickins
2009-10-07  7:43   ` Jan Beulich
2009-10-07 12:08     ` Hugh Dickins [this message]
2009-10-07 12:20       ` Jan Beulich
2009-10-07  8:59   ` Jan Beulich

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=Pine.LNX.4.64.0910071300330.28844@sister.anvils \
    --to=hugh.dickins@tiscali.co.uk \
    --cc=JBeulich@novell.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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