diff options
author | Pekka Enberg <penberg@kernel.org> | 2012-10-03 02:56:37 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2012-10-03 02:56:37 -0400 |
commit | f4178cdddd4cb860a17f363fe13264fff03da7f2 (patch) | |
tree | 5ca8dc6bb09bcb2c4b959b60712d7a3f60c7a43f /mm/slob.c | |
parent | 023dc70470502f41b285112d4840f35d9075b767 (diff) | |
parent | f28510d30c7f03daa290019fbc57ad8277347614 (diff) |
Merge branch 'slab/common-for-cgroups' into slab/for-linus
Fix up a trivial conflict with NUMA_NO_NODE cleanups.
Conflicts:
mm/slob.c
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slob.c')
-rw-r--r-- | mm/slob.c | 60 |
1 files changed, 27 insertions, 33 deletions
@@ -529,44 +529,24 @@ size_t ksize(const void *block) | |||
529 | } | 529 | } |
530 | EXPORT_SYMBOL(ksize); | 530 | EXPORT_SYMBOL(ksize); |
531 | 531 | ||
532 | struct kmem_cache *__kmem_cache_create(const char *name, size_t size, | 532 | int __kmem_cache_create(struct kmem_cache *c, unsigned long flags) |
533 | size_t align, unsigned long flags, void (*ctor)(void *)) | ||
534 | { | 533 | { |
535 | struct kmem_cache *c; | 534 | size_t align = c->size; |
536 | 535 | ||
537 | c = slob_alloc(sizeof(struct kmem_cache), | 536 | if (flags & SLAB_DESTROY_BY_RCU) { |
538 | GFP_KERNEL, ARCH_KMALLOC_MINALIGN, NUMA_NO_NODE); | 537 | /* leave room for rcu footer at the end of object */ |
539 | 538 | c->size += sizeof(struct slob_rcu); | |
540 | if (c) { | ||
541 | c->name = name; | ||
542 | c->size = size; | ||
543 | if (flags & SLAB_DESTROY_BY_RCU) { | ||
544 | /* leave room for rcu footer at the end of object */ | ||
545 | c->size += sizeof(struct slob_rcu); | ||
546 | } | ||
547 | c->flags = flags; | ||
548 | c->ctor = ctor; | ||
549 | /* ignore alignment unless it's forced */ | ||
550 | c->align = (flags & SLAB_HWCACHE_ALIGN) ? SLOB_ALIGN : 0; | ||
551 | if (c->align < ARCH_SLAB_MINALIGN) | ||
552 | c->align = ARCH_SLAB_MINALIGN; | ||
553 | if (c->align < align) | ||
554 | c->align = align; | ||
555 | |||
556 | kmemleak_alloc(c, sizeof(struct kmem_cache), 1, GFP_KERNEL); | ||
557 | c->refcount = 1; | ||
558 | } | 539 | } |
559 | return c; | 540 | c->flags = flags; |
560 | } | 541 | /* ignore alignment unless it's forced */ |
542 | c->align = (flags & SLAB_HWCACHE_ALIGN) ? SLOB_ALIGN : 0; | ||
543 | if (c->align < ARCH_SLAB_MINALIGN) | ||
544 | c->align = ARCH_SLAB_MINALIGN; | ||
545 | if (c->align < align) | ||
546 | c->align = align; | ||
561 | 547 | ||
562 | void kmem_cache_destroy(struct kmem_cache *c) | 548 | return 0; |
563 | { | ||
564 | kmemleak_free(c); | ||
565 | if (c->flags & SLAB_DESTROY_BY_RCU) | ||
566 | rcu_barrier(); | ||
567 | slob_free(c, sizeof(struct kmem_cache)); | ||
568 | } | 549 | } |
569 | EXPORT_SYMBOL(kmem_cache_destroy); | ||
570 | 550 | ||
571 | void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node) | 551 | void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node) |
572 | { | 552 | { |
@@ -634,14 +614,28 @@ unsigned int kmem_cache_size(struct kmem_cache *c) | |||
634 | } | 614 | } |
635 | EXPORT_SYMBOL(kmem_cache_size); | 615 | EXPORT_SYMBOL(kmem_cache_size); |
636 | 616 | ||
617 | int __kmem_cache_shutdown(struct kmem_cache *c) | ||
618 | { | ||
619 | /* No way to check for remaining objects */ | ||
620 | return 0; | ||
621 | } | ||
622 | |||
637 | int kmem_cache_shrink(struct kmem_cache *d) | 623 | int kmem_cache_shrink(struct kmem_cache *d) |
638 | { | 624 | { |
639 | return 0; | 625 | return 0; |
640 | } | 626 | } |
641 | EXPORT_SYMBOL(kmem_cache_shrink); | 627 | EXPORT_SYMBOL(kmem_cache_shrink); |
642 | 628 | ||
629 | struct kmem_cache kmem_cache_boot = { | ||
630 | .name = "kmem_cache", | ||
631 | .size = sizeof(struct kmem_cache), | ||
632 | .flags = SLAB_PANIC, | ||
633 | .align = ARCH_KMALLOC_MINALIGN, | ||
634 | }; | ||
635 | |||
643 | void __init kmem_cache_init(void) | 636 | void __init kmem_cache_init(void) |
644 | { | 637 | { |
638 | kmem_cache = &kmem_cache_boot; | ||
645 | slab_state = UP; | 639 | slab_state = UP; |
646 | } | 640 | } |
647 | 641 | ||