summaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
authorAkinobu Mita2008-12-23 11:37:01 +0100
committerPekka Enberg2008-12-29 10:27:46 +0100
commit773ff60e841461cb1f9374a713ffcda029b8c317 (patch)
treec3691b5a82261a3d2c1861f2913774faac63fa96 /mm/slub.c
parentMerge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/p... (diff)
downloadkernel-qcow2-linux-773ff60e841461cb1f9374a713ffcda029b8c317.tar.gz
kernel-qcow2-linux-773ff60e841461cb1f9374a713ffcda029b8c317.tar.xz
kernel-qcow2-linux-773ff60e841461cb1f9374a713ffcda029b8c317.zip
SLUB: failslab support
Currently fault-injection capability for SLAB allocator is only available to SLAB. This patch makes it available to SLUB, too. [penberg@cs.helsinki.fi: unify slab and slub implementations] Cc: Christoph Lameter <cl@linux-foundation.org> Cc: Matt Mackall <mpm@selenic.com> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/slub.c b/mm/slub.c
index a2cd47d89e0a..640fde7e354c 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -24,6 +24,7 @@
#include <linux/kallsyms.h>
#include <linux/memory.h>
#include <linux/math64.h>
+#include <linux/fault-inject.h>
/*
* Lock order:
@@ -1591,6 +1592,9 @@ static __always_inline void *slab_alloc(struct kmem_cache *s,
unsigned long flags;
unsigned int objsize;
+ if (should_failslab(s->objsize, gfpflags))
+ return NULL;
+
local_irq_save(flags);
c = get_cpu_slab(s, smp_processor_id());
objsize = c->objsize;