[PATCH] numa: fix slab_node(MPOL_BIND)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Dumazet
Date: Wednesday, October 27, 2010 - 10:33 am

Le mercredi 27 octobre 2010 à 18:07 +0200, Eric Dumazet a écrit :


Crash in fact, not freeze, in slab_node()

Problem is : we dereference a NULL zone pointer.

(node 1 has HighMem only)

Following patch seems to solve the problem for me

# swapoff -a
# numactl --membind=1 swapon -a
# grep swap /proc/vmallocinfo 
0xf9da5000-0xf9ea6000 1052672 sys_swapon+0x3f9/0xa34 pages=256 vmalloc N1=256


Thanks


[PATCH] numa: fix slab_node(MPOL_BIND) 

When a node contains only HighMem memory, slab_node(MPOL_BIND)
dereferences a NULL pointer.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 mm/mempolicy.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 81a1276..4a57f13 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1597,7 +1597,7 @@ unsigned slab_node(struct mempolicy *policy)
 		(void)first_zones_zonelist(zonelist, highest_zoneidx,
 							&policy->v.nodes,
 							&zone);
-		return zone->node;
+		return zone ? zone->node : numa_node_id();
 	}
 
 	default:


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] x86, percpu: revert commit fe8e0c25, Tejun Heo, (Tue Oct 26, 5:45 am)
Re: [PATCH] x86, percpu: revert commit fe8e0c25, Ingo Molnar, (Tue Oct 26, 6:25 am)
Re: [PATCH] x86, percpu: revert commit fe8e0c25, Tejun Heo, (Tue Oct 26, 6:34 am)
Re: [PATCH] x86, percpu: revert commit fe8e0c25, Brian Gerst, (Tue Oct 26, 6:49 am)
Re: [PATCH] x86, percpu: revert commit fe8e0c25, Linus Torvalds, (Tue Oct 26, 8:08 am)
[tip:x86/urgent] x86-32: Allocate irq stacks seperate from ..., tip-bot for Brian Gerst, (Wed Oct 27, 9:03 am)
[tip:x86/urgent] percpu: Remove the multi-page alignment f ..., tip-bot for Ingo Molnar, (Wed Oct 27, 9:04 am)
[PATCH] numa: fix slab_node(MPOL_BIND), Eric Dumazet, (Wed Oct 27, 10:33 am)
[PATCH] x86-32: NUMA irq stacks allocations, Eric Dumazet, (Thu Oct 28, 7:40 am)
Re: [PATCH] numa: fix slab_node(MPOL_BIND), Linus Torvalds, (Thu Oct 28, 8:59 am)
Re: [PATCH] numa: fix slab_node(MPOL_BIND), Eric Dumazet, (Thu Oct 28, 9:27 am)
Re: [PATCH] numa: fix slab_node(MPOL_BIND), Mel Gorman, (Thu Oct 28, 9:45 am)
Re: [PATCH] numa: fix slab_node(MPOL_BIND), Christoph Lameter, (Thu Oct 28, 9:55 am)
Re: [PATCH] numa: fix slab_node(MPOL_BIND), Andrew Morton, (Thu Oct 28, 2:07 pm)
[tip:x86/urgent] x86-32: Restore irq stacks NUMA-aware all ..., tip-bot for Eric Dumazet, (Thu Oct 28, 11:43 pm)
Re: [PATCH] numa: fix slab_node(MPOL_BIND), Christoph Lameter, (Fri Oct 29, 7:55 am)