]> git.baikalelectronics.ru Git - kernel.git/commit
KMEM_CACHE(): simplify slab cache creation
authorChristoph Lameter <clameter@sgi.com>
Sun, 6 May 2007 21:49:57 +0000 (14:49 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 7 May 2007 19:12:55 +0000 (12:12 -0700)
commitc0e28cf98687da8488064f4e2dcf702d1c65c1ea
treea945e829bf6bf7a93bf844b2ee9f2a3a2fa17c5d
parent876b5f5adce07c9cc7b7ea6f8cbbf275c8b09b55
KMEM_CACHE(): simplify slab cache creation

This patch provides a new macro

KMEM_CACHE(<struct>, <flags>)

to simplify slab creation. KMEM_CACHE creates a slab with the name of the
struct, with the size of the struct and with the alignment of the struct.
Additional slab flags may be specified if necessary.

Example

struct test_slab {
int a,b,c;
struct list_head;
} __cacheline_aligned_in_smp;

test_slab_cache = KMEM_CACHE(test_slab, SLAB_PANIC)

will create a new slab named "test_slab" of the size sizeof(struct
test_slab) and aligned to the alignment of test slab.  If it fails then we
panic.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
block/cfq-iosched.c
fs/aio.c
fs/bio.c
fs/dcache.c
include/linux/slab.h
kernel/delayacct.c
kernel/pid.c
kernel/signal.c
kernel/taskstats.c