From: David Rientjes <rientjes@google.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: submit@firstfloor.org, linux-kernel@vger.kernel.org,
haicheng.li@intel.com, Pekka Enberg <penberg@cs.helsinki.fi>,
linux-mm@kvack.org
Subject: Re: [PATCH] [1/4] SLAB: Handle node-not-up case in fallback_alloc()
Date: Fri, 5 Feb 2010 13:06:56 -0800 (PST) [thread overview]
Message-ID: <alpine.DEB.2.00.1002051251390.2376@chino.kir.corp.google.com> (raw)
In-Reply-To: <20100203213912.D3081B1620@basil.firstfloor.org>
On Wed, 3 Feb 2010, Andi Kleen wrote:
> When fallback_alloc() runs the node of the CPU might not be initialized yet.
> Handle this case by allocating in another node.
>
That other node must be allowed by current's cpuset, otherwise
kmem_getpages() will fail when get_page_from_freelist() iterates only over
unallowed nodes.
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
>
> ---
> mm/slab.c | 19 ++++++++++++++++++-
> 1 file changed, 18 insertions(+), 1 deletion(-)
>
> Index: linux-2.6.33-rc3-ak/mm/slab.c
> ===================================================================
> --- linux-2.6.33-rc3-ak.orig/mm/slab.c
> +++ linux-2.6.33-rc3-ak/mm/slab.c
> @@ -3210,7 +3210,24 @@ retry:
> if (local_flags & __GFP_WAIT)
> local_irq_enable();
> kmem_flagcheck(cache, flags);
> - obj = kmem_getpages(cache, local_flags, numa_node_id());
> +
> + /*
> + * Node not set up yet? Try one that the cache has been set up
> + * for.
> + */
> + nid = numa_node_id();
> + if (cache->nodelists[nid] == NULL) {
> + for_each_zone_zonelist(zone, z, zonelist, high_zoneidx) {
> + nid = zone_to_nid(zone);
> + if (cache->nodelists[nid])
> + break;
If you set a bit in a nodemask_t everytime ____cache_alloc_node() fails in
the previous for_each_zone_zonelist() iteration, you could just iterate
that nodemask here without duplicating the zone_to_nid() and
cache->nodelists[nid] != NULL check.
nid = numa_node_id();
if (!cache->nodelists[nid])
for_each_node_mask(nid, allowed_nodes) {
obj = kmem_getpages(cache, local_flags, nid);
if (obj)
break;
}
else
obj = kmem_getpages(cache, local_flags, nid);
This way you can try all allowed nodes for memory instead of just one when
cache->nodelists[numa_node_id()] == NULL.
> + }
> + if (!cache->nodelists[nid])
> + return NULL;
> + }
> +
> +
> + obj = kmem_getpages(cache, local_flags, nid);
> if (local_flags & __GFP_WAIT)
> local_irq_disable();
> if (obj) {
--
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:[~2010-02-05 21:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-03 21:39 [PATCH] [0/4] SLAB: Fix a couple of slab memory hotadd issues Andi Kleen
2010-02-03 21:39 ` [PATCH] [1/4] SLAB: Handle node-not-up case in fallback_alloc() Andi Kleen
2010-02-05 21:06 ` David Rientjes [this message]
2010-02-06 7:25 ` Andi Kleen
2010-02-06 9:53 ` David Rientjes
2010-02-06 15:56 ` Andi Kleen
2010-02-06 22:31 ` David Rientjes
2010-02-03 21:39 ` [PATCH] [2/4] SLAB: Set up the l3 lists for the memory of freshly added memory Andi Kleen
2010-02-05 19:12 ` Christoph Lameter
2010-02-05 21:17 ` David Rientjes
2010-02-06 7:26 ` Andi Kleen
2010-02-06 9:47 ` David Rientjes
2010-02-03 21:39 ` [PATCH] [3/4] SLAB: Separate node initialization into separate function Andi Kleen
2010-02-05 19:15 ` Christoph Lameter
2010-02-05 21:29 ` David Rientjes
2010-02-06 7:27 ` Andi Kleen
2010-02-06 9:55 ` David Rientjes
2010-02-03 21:39 ` [PATCH] [4/4] SLAB: Fix node add timer race in cache_reap Andi Kleen
2010-02-05 19:16 ` Christoph Lameter
2010-02-05 8:27 ` [PATCH] [0/4] SLAB: Fix a couple of slab memory hotadd issues Pekka Enberg
2010-02-05 19:19 ` Christoph Lameter
2010-02-05 20:22 ` Andi Kleen
2010-02-05 20:55 ` Christoph Lameter
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=alpine.DEB.2.00.1002051251390.2376@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=andi@firstfloor.org \
--cc=haicheng.li@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@cs.helsinki.fi \
--cc=submit@firstfloor.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