From: Nick Piggin <npiggin@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, davem@davemloft.net
Subject: Re: [patch] radix-tree: avoid atomic allocations for preloaded insertions
Date: Thu, 8 Nov 2007 06:44:46 +0100 [thread overview]
Message-ID: <20071108054445.GA20162@wotan.suse.de> (raw)
In-Reply-To: <20071107210204.62070047.akpm@linux-foundation.org>
On Wed, Nov 07, 2007 at 09:02:04PM -0800, Andrew Morton wrote:
> > On Thu, 8 Nov 2007 05:54:04 +0100 Nick Piggin <npiggin@suse.de> wrote:
> > > - doesn't solve the problem which it claims to be solving
> > > (radix_tree_insert() doesn't deplete atomic reserves as long as the
> > > caller uses radix_tree_preload(GFP_KERNEL))
> >
> > I'm pretty sure it does. I don't follow exactly why you say it doesn't.
> >
>
> I was wrong. The radix_tree_preloads will remain full and we'll just keep
> on doing GFP_ATOMIC allocations.
OK. Normally it's not a huge issue, because you've recently allocated a
page, but actually it can become a problem if: the page comes out of a
different zone than the radix tree node; or you're doing something like
mpage_readpages code that can do a lot of work between allocating the
pages and inserting them.
> > > - is probably desirable as a simplify-the-locking-hierarchy thing, but a)
> > > should be presented as such and
> >
> > It's primarily to avoid GFP_ATOMIC allocations. Simplify the locking
> > hierarcy is secondary and I put that in the changelog.
> >
> >
> > > b) needs code comments explaining why it
> > > is correct and needs a big fat TODO explaining how we should get that
> > > kmem_cache_alloc() out of there, an how we should do it.
> > >
> > > OK?
> >
> > I don't really know about getting that kmem_cache_alloc out of there.
> > For radix trees that are protected by sleeping locks, you don't actually
> > need to disable preempt and you can do sleeping allocations there.
>
> If the radix tree's gfp_mask is GFP_ATOMIC, radix_tree_insert() can require
> that the preloads be full.
So we can put that invariant check in radix_tree_insert(), and I could
refactor / comment the radix_tree_node_alloc a bit so that it is clearer?
--
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>
next prev parent reply other threads:[~2007-11-08 5:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-08 0:43 Nick Piggin
2007-11-08 1:09 ` Andrew Morton
2007-11-08 1:34 ` David Miller, Andrew Morton
2007-11-08 1:41 ` Andrew Morton
2007-11-08 1:45 ` David Miller, Andrew Morton
2007-11-08 1:37 ` Nick Piggin
2007-11-08 3:02 ` Andrew Morton
2007-11-08 3:16 ` Nick Piggin
2007-11-08 4:12 ` Andrew Morton
2007-11-08 4:54 ` Nick Piggin
2007-11-08 5:02 ` Andrew Morton
2007-11-08 5:44 ` Nick Piggin [this message]
2007-11-08 6:02 ` Andrew Morton
2007-11-08 6:54 ` Nick Piggin
2007-11-08 6:56 ` [patch] nfs: use GFP_NOFS preloads for radix-tree insertion Nick Piggin
2007-11-13 10:55 ` Peter Zijlstra
2007-11-14 4:20 ` Nick Piggin
2007-11-14 9:06 ` Peter Zijlstra
2007-11-14 15:39 ` Nick Piggin
2007-11-08 11:57 ` [patch] radix-tree: avoid atomic allocations for preloaded insertions Peter Zijlstra
2007-11-08 20:37 ` Nick Piggin
2007-11-08 20:47 ` Peter Zijlstra
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=20071108054445.GA20162@wotan.suse.de \
--to=npiggin@suse.de \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--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