Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54223
b: refs/heads/master
c: 0a31bd5
h: refs/heads/master
i:
  54221: 3c70193
  54219: caff6eb
  54215: 8aa3aac
  54207: 738a4eb
v: v3
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed May 7, 2007
1 parent 4524642 commit e1334e0
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5af60839909b8e3b28ca7cd7912fa0b23475617f
refs/heads/master: 0a31bd5f2bbb6473ef9d24f0063ca91cfa678b64
6 changes: 2 additions & 4 deletions trunk/block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -2090,13 +2090,11 @@ static void cfq_slab_kill(void)

static int __init cfq_slab_setup(void)
{
cfq_pool = kmem_cache_create("cfq_pool", sizeof(struct cfq_queue), 0, 0,
NULL, NULL);
cfq_pool = KMEM_CACHE(cfq_queue, 0);
if (!cfq_pool)
goto fail;

cfq_ioc_pool = kmem_cache_create("cfq_ioc_pool",
sizeof(struct cfq_io_context), 0, 0, NULL, NULL);
cfq_ioc_pool = KMEM_CACHE(cfq_io_context, 0);
if (!cfq_ioc_pool)
goto fail;

Expand Down
6 changes: 2 additions & 4 deletions trunk/fs/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ static void aio_queue_work(struct kioctx *);
*/
static int __init aio_setup(void)
{
kiocb_cachep = kmem_cache_create("kiocb", sizeof(struct kiocb),
0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
kioctx_cachep = kmem_cache_create("kioctx", sizeof(struct kioctx),
0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC);
kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC);

aio_wq = create_workqueue("aio");

Expand Down
3 changes: 1 addition & 2 deletions trunk/fs/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1193,8 +1193,7 @@ static void __init biovec_init_slabs(void)

static int __init init_bio(void)
{
bio_slab = kmem_cache_create("bio", sizeof(struct bio), 0,
SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
bio_slab = KMEM_CACHE(bio, SLAB_HWCACHE_ALIGN|SLAB_PANIC);

biovec_init_slabs();

Expand Down
8 changes: 2 additions & 6 deletions trunk/fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -2052,12 +2052,8 @@ static void __init dcache_init(unsigned long mempages)
* but it is probably not worth it because of the cache nature
* of the dcache.
*/
dentry_cache = kmem_cache_create("dentry_cache",
sizeof(struct dentry),
0,
(SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
SLAB_MEM_SPREAD),
NULL, NULL);
dentry_cache = KMEM_CACHE(dentry,
SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD);

set_shrinker(DEFAULT_SEEKS, shrink_dcache_memory);

Expand Down
12 changes: 12 additions & 0 deletions trunk/include/linux/slab.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ unsigned int kmem_cache_size(struct kmem_cache *);
const char *kmem_cache_name(struct kmem_cache *);
int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr);

/*
* Please use this macro to create slab caches. Simply specify the
* name of the structure and maybe some flags that are listed above.
*
* The alignment of the struct determines object alignment. If you
* f.e. add ____cacheline_aligned_in_smp to the struct declaration
* then the objects will be properly aligned in SMP configurations.
*/
#define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
sizeof(struct __struct), __alignof__(struct __struct),\
(__flags), NULL, NULL)

#ifdef CONFIG_NUMA
extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
#else
Expand Down
6 changes: 1 addition & 5 deletions trunk/kernel/delayacct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 1 addition & 3 deletions trunk/kernel/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
6 changes: 1 addition & 5 deletions trunk/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -2636,9 +2636,5 @@ __attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma)

void __init signals_init(void)
{
sigqueue_cachep =
kmem_cache_create("sigqueue",
sizeof(struct sigqueue),
__alignof__(struct sigqueue),
SLAB_PANIC, NULL, NULL);
sigqueue_cachep = KMEM_CACHE(sigqueue, SLAB_PANIC);
}
4 changes: 1 addition & 3 deletions trunk/kernel/taskstats.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,7 @@ void __init taskstats_init_early(void)
{
unsigned int i;

taskstats_cache = kmem_cache_create("taskstats_cache",
sizeof(struct taskstats),
0, SLAB_PANIC, NULL, NULL);
taskstats_cache = KMEM_CACHE(taskstats, SLAB_PANIC);
for_each_possible_cpu(i) {
INIT_LIST_HEAD(&(per_cpu(listener_array, i).list));
init_rwsem(&(per_cpu(listener_array, i).sem));
Expand Down

0 comments on commit e1334e0

Please sign in to comment.