[PATCH 2/3] slqb: Treat pages freed on a memoryless node as local node

From: Mel Gorman
Date: Fri Sep 18 2009 - 15:34:28 EST


When a page is being freed belonging to a remote node, it is added to a
separate list. When the node is memoryless, pages are always allocated
on the front for the per-cpu local and always freed remote. This is
similar to a leak and the machine quickly goes OOM and drives over the
cliff faster than Thelma and Louise.

This patch treats pages being freed from remote nodes as if they are local
if the CPU is on a memoryless node. It's now known at time of writing if this
is the best approach so reviewed-bys from those familiar with SLQB are needed.

Signed-off-by: Mel Gorman <mel@xxxxxxxxx>
---
mm/slqb.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/mm/slqb.c b/mm/slqb.c
index 4d72be2..0f46b56 100644
--- a/mm/slqb.c
+++ b/mm/slqb.c
@@ -1726,6 +1726,7 @@ static __always_inline void __slab_free(struct kmem_cache *s,
struct kmem_cache_cpu *c;
struct kmem_cache_list *l;
int thiscpu = smp_processor_id();
+ int thisnode = numa_node_id();

c = get_cpu_slab(s, thiscpu);
l = &c->list;
@@ -1733,12 +1734,14 @@ static __always_inline void __slab_free(struct kmem_cache *s,
slqb_stat_inc(l, FREE);

if (!NUMA_BUILD || !slab_numa(s) ||
- likely(slqb_page_to_nid(page) == numa_node_id())) {
+ likely(slqb_page_to_nid(page) == numa_node_id() ||
+ !node_state(thisnode, N_HIGH_MEMORY))) {
/*
* Freeing fastpath. Collects all local-node objects, not
* just those allocated from our per-CPU list. This allows
* fast transfer of objects from one CPU to another within
- * a given node.
+ * a given node. If the current node is memoryless, the
+ * pages are treated as local
*/
set_freepointer(s, object, l->freelist.head);
l->freelist.head = object;
--
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/