diff options
author | Christoph Lameter <clameter@sgi.com> | 2007-05-06 23:49:57 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 21:12:55 +0200 |
commit | 0a31bd5f2bbb6473ef9d24f0063ca91cfa678b64 (patch) | |
tree | a945e829bf6bf7a93bf844b2ee9f2a3a2fa17c5d /kernel/pid.c | |
parent | slab allocators: Remove obsolete SLAB_MUST_HWCACHE_ALIGN (diff) | |
download | linux-0a31bd5f2bbb6473ef9d24f0063ca91cfa678b64.tar.xz linux-0a31bd5f2bbb6473ef9d24f0063ca91cfa678b64.zip |
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>
Diffstat (limited to 'kernel/pid.c')
-rw-r--r-- | kernel/pid.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/kernel/pid.c b/kernel/pid.c index 78f2aee90f54..9c80bc23d6b8 100644 --- a/kernel/pid.c +++ b/kernel/pid.c @@ -412,7 +412,5 @@ void __init pidmap_init(void) set_bit(0, init_pid_ns.pidmap[0].page); atomic_dec(&init_pid_ns.pidmap[0].nr_free); - pid_cachep = kmem_cache_create("pid", sizeof(struct pid), - __alignof__(struct pid), - SLAB_PANIC, NULL, NULL); + pid_cachep = KMEM_CACHE(pid, SLAB_PANIC); } |