diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2008-12-23 05:37:01 -0500 |
---|---|---|
committer | Pekka Enberg <penberg@cs.helsinki.fi> | 2008-12-29 04:27:46 -0500 |
commit | 773ff60e841461cb1f9374a713ffcda029b8c317 (patch) | |
tree | c3691b5a82261a3d2c1861f2913774faac63fa96 /mm/slub.c | |
parent | 3c92ec8ae91ecf59d88c798301833d7cf83f2179 (diff) |
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.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/kallsyms.h> | 24 | #include <linux/kallsyms.h> |
25 | #include <linux/memory.h> | 25 | #include <linux/memory.h> |
26 | #include <linux/math64.h> | 26 | #include <linux/math64.h> |
27 | #include <linux/fault-inject.h> | ||
27 | 28 | ||
28 | /* | 29 | /* |
29 | * Lock order: | 30 | * Lock order: |
@@ -1591,6 +1592,9 @@ static __always_inline void *slab_alloc(struct kmem_cache *s, | |||
1591 | unsigned long flags; | 1592 | unsigned long flags; |
1592 | unsigned int objsize; | 1593 | unsigned int objsize; |
1593 | 1594 | ||
1595 | if (should_failslab(s->objsize, gfpflags)) | ||
1596 | return NULL; | ||
1597 | |||
1594 | local_irq_save(flags); | 1598 | local_irq_save(flags); |
1595 | c = get_cpu_slab(s, smp_processor_id()); | 1599 | c = get_cpu_slab(s, smp_processor_id()); |
1596 | objsize = c->objsize; | 1600 | objsize = c->objsize; |