linux v2.6.22.21-op1-rc1 patches
[linux-2.6.22.y-op-patches.git] / review-2.6.22.y / slab-NUMA-slab-allocator-migration-bugfix.patch
blobeeb8210d8f39a595c73b1cf311b1925e02708fbc
1 From 6d2144d355d2a532e5cc3fc12a6ba2a8d4ef15e4 Mon Sep 17 00:00:00 2001
2 From: Joe Korty <joe.korty@ccur.com>
3 Date: Wed, 5 Mar 2008 15:04:59 -0800
4 Subject: [PATCH] slab: NUMA slab allocator migration bugfix
6 NUMA slab allocator cpu migration bugfix
8 The NUMA slab allocator (specifically, cache_alloc_refill)
9 is not refreshing its local copies of what cpu and what
10 numa node it is on, when it drops and reacquires the irq
11 block that it inherited from its caller. As a result
12 those values become invalid if an attempt to migrate the
13 process to another numa node occured while the irq block
14 had been dropped.
16 The solution is to make cache_alloc_refill reload these
17 variables whenever it drops and reacquires the irq block.
19 The error is very difficult to hit. When it does occur,
20 one gets the following oops + stack traceback bits in
21 check_spinlock_acquired:
23 kernel BUG at mm/slab.c:2417
24 cache_alloc_refill+0xe6
25 kmem_cache_alloc+0xd0
26 ...
28 This patch was developed against 2.6.23, ported to and
29 compiled-tested only against 2.6.25-rc4.
31 Signed-off-by: Joe Korty <joe.korty@ccur.com>
32 Signed-off-by: Christoph Lameter <clameter@sgi.com>
33 Signed-off-by: Oliver Pinter <oliver.pntr@gmail.com>
36 diff --git a/mm/slab.c b/mm/slab.c
37 index f7faff7..e6c698f 100644
38 --- a/mm/slab.c
39 +++ b/mm/slab.c
40 @@ -2964,11 +2964,10 @@ static void *cache_alloc_refill(struct kmem_cache *cachep, gfp_t flags)
41 struct array_cache *ac;
42 int node;
44 - node = numa_node_id();
46 +retry:
47 check_irq_off();
48 + node = numa_node_id();
49 ac = cpu_cache_get(cachep);
50 -retry:
51 batchcount = ac->batchcount;
52 if (!ac->touched && batchcount > BATCHREFILL_LIMIT) {