From: David Rientjes <rientjes@google.com>
To: Pekka Enberg <penberg@cs.helsinki.fi>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Paul Menage <menage@google.com>,
Christoph Lameter <cl@linux-foundation.org>,
Randy Dunlap <randy.dunlap@oracle.com>,
linux-kernel@vger.kernel.org
Subject: [patch 2/2] slub: enforce cpuset restrictions for cpu slabs
Date: Mon, 2 Mar 2009 20:50:18 -0800 (PST) [thread overview]
Message-ID: <alpine.DEB.2.00.0903022011430.17284@chino.kir.corp.google.com> (raw)
In-Reply-To: <alpine.DEB.2.00.0903022009490.17284@chino.kir.corp.google.com>
Slab allocations should respect cpuset hardwall restrictions. Otherwise,
it is possible for tasks in a cpuset to fill slabs allocated on mems
assigned to a disjoint cpuset.
When an allocation is attempted for a cpu slab that resides on a node that
is not allowed by a task's cpuset, an appropriate partial slab or new slab
is allocated.
If an allocation is intended for a particular node that the task does not
have access to because of its cpuset, an allowed partial slab is used
instead of failing.
Cc: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: David Rientjes <rientjes@google.com>
---
mm/slub.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1353,6 +1353,8 @@ static struct page *get_partial(struct kmem_cache *s, gfp_t flags, int node)
struct page *page;
int searchnode = (node == -1) ? numa_node_id() : node;
+ if (!cpuset_node_allowed_hardwall(searchnode, flags))
+ searchnode = cpuset_mem_spread_node();
page = get_partial_node(get_node(s, searchnode));
if (page || (flags & __GFP_THISNODE))
return page;
@@ -1477,13 +1479,13 @@ static void flush_all(struct kmem_cache *s)
* Check if the objects in a per cpu structure fit numa
* locality expectations.
*/
-static inline int node_match(struct kmem_cache_cpu *c, int node)
+static inline int node_match(struct kmem_cache_cpu *c, int node, gfp_t gfpflags)
{
#ifdef CONFIG_NUMA
if (node != -1 && c->node != node)
return 0;
#endif
- return 1;
+ return cpuset_node_allowed_hardwall(c->node, gfpflags);
}
/*
@@ -1517,7 +1519,7 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
goto new_slab;
slab_lock(c->page);
- if (unlikely(!node_match(c, node)))
+ if (unlikely(!node_match(c, node, gfpflags)))
goto another_slab;
stat(c, ALLOC_REFILL);
@@ -1604,7 +1606,7 @@ static __always_inline void *slab_alloc(struct kmem_cache *s,
local_irq_save(flags);
c = get_cpu_slab(s, smp_processor_id());
objsize = c->objsize;
- if (unlikely(!c->freelist || !node_match(c, node)))
+ if (unlikely(!c->freelist || !node_match(c, node, gfpflags)))
object = __slab_alloc(s, gfpflags, node, addr, c);
next prev parent reply other threads:[~2009-03-03 4:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-03 4:50 [patch 1/2] cpusets: replace zone allowed functions with node allowed David Rientjes
2009-03-03 4:50 ` David Rientjes [this message]
2009-03-03 16:47 ` [patch 2/2] slub: enforce cpuset restrictions for cpu slabs Christoph Lameter
2009-03-03 17:19 ` David Rientjes
2009-03-03 18:46 ` Christoph Lameter
2009-03-03 19:05 ` David Rientjes
2009-03-03 20:14 ` Christoph Lameter
2009-03-03 21:35 ` David Rientjes
2009-03-03 21:55 ` Paul Menage
2009-03-03 22:29 ` David Rientjes
2009-03-04 0:53 ` Paul Menage
2009-03-04 1:14 ` David Rientjes
2009-03-04 15:23 ` Christoph Lameter
2009-03-04 18:06 ` David Rientjes
2009-03-03 16:36 ` [patch 1/2] cpusets: replace zone allowed functions with node allowed 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.0903022011430.17284@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
--cc=penberg@cs.helsinki.fi \
--cc=randy.dunlap@oracle.com \
/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
all inboxes | Powered by JetHome®