From 2fd66c517d5e98de2528d86e0e62f5069ff99f59 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Tue, 22 Mar 2011 13:32:53 -0500 Subject: [PATCH 1/2] slub: Add missing irq restore for the OOM path OOM path is missing the irq restore in the CONFIG_CMPXCHG_LOCAL case. Signed-off-by: Christoph Lameter Signed-off-by: Pekka Enberg --- mm/slub.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/slub.c b/mm/slub.c index 7e4f835e32ab..e126cfbd3df2 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1857,6 +1857,9 @@ new_slab: } if (!(gfpflags & __GFP_NOWARN) && printk_ratelimit()) slab_out_of_memory(s, gfpflags, node); +#ifdef CONFIG_CMPXCHG_LOCAL + local_irq_restore(flags); +#endif return NULL; debug: if (!alloc_debug_processing(s, c->page, object, addr)) From 4fdccdfbb4652a7bbac8adbce7449eb093775118 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Tue, 22 Mar 2011 13:35:00 -0500 Subject: [PATCH 2/2] slub: Add statistics for this_cmpxchg_double failures Add some statistics for debugging. Signed-off-by: Christoph Lameter Signed-off-by: Pekka Enberg --- include/linux/slub_def.h | 1 + mm/slub.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 90fbb6d87e11..45ca123e8002 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h @@ -32,6 +32,7 @@ enum stat_item { DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */ DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */ ORDER_FALLBACK, /* Number of times fallback was necessary */ + CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */ NR_SLUB_STAT_ITEMS }; struct kmem_cache_cpu { diff --git a/mm/slub.c b/mm/slub.c index e126cfbd3df2..93de30db95f5 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -217,7 +217,7 @@ static inline void sysfs_slab_remove(struct kmem_cache *s) #endif -static inline void stat(struct kmem_cache *s, enum stat_item si) +static inline void stat(const struct kmem_cache *s, enum stat_item si) { #ifdef CONFIG_SLUB_STATS __this_cpu_inc(s->cpu_slab->stat[si]); @@ -1597,6 +1597,7 @@ static inline void note_cmpxchg_failure(const char *n, printk("for unknown reason: actual=%lx was=%lx target=%lx\n", actual_tid, tid, next_tid(tid)); #endif + stat(s, CMPXCHG_DOUBLE_CPU_FAIL); } #endif