mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 13:41:30 +00:00
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>
This commit is contained in:
parent
5af6083990
commit
0a31bd5f2b
9 changed files with 23 additions and 32 deletions
|
@ -31,11 +31,7 @@ __setup("nodelayacct", delayacct_setup_disable);
|
|||
|
||||
void delayacct_init(void)
|
||||
{
|
||||
delayacct_cache = kmem_cache_create("delayacct_cache",
|
||||
sizeof(struct task_delay_info),
|
||||
0,
|
||||
SLAB_PANIC,
|
||||
NULL, NULL);
|
||||
delayacct_cache = KMEM_CACHE(task_delay_info, SLAB_PANIC);
|
||||
delayacct_tsk_init(&init_task);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue