diff options
author | Joonsoo Kim <iamjoonsoo.kim@lge.com> | 2014-10-09 18:26:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-09 22:25:51 -0400 |
commit | bf0dea23a9c094ae869a88bb694fbe966671bf6d (patch) | |
tree | 420ca01f321664323b3ad0eeead8f2b4e04cd51e /mm/slab.h | |
parent | 12220dea07f1ac6ac717707104773d771c3f3077 (diff) |
mm/slab: use percpu allocator for cpu cache
Because of chicken and egg problem, initialization of SLAB is really
complicated. We need to allocate cpu cache through SLAB to make the
kmem_cache work, but before initialization of kmem_cache, allocation
through SLAB is impossible.
On the other hand, SLUB does initialization in a more simple way. It uses
percpu allocator to allocate cpu cache so there is no chicken and egg
problem.
So, this patch try to use percpu allocator in SLAB. This simplifies the
initialization step in SLAB so that we could maintain SLAB code more
easily.
In my testing there is no performance difference.
This implementation relies on percpu allocator. Because percpu allocator
uses vmalloc address space, vmalloc address space could be exhausted by
this change on many cpu system with *32 bit* kernel. This implementation
can cover 1024 cpus in worst case by following calculation.
Worst: 1024 cpus * 4 bytes for pointer * 300 kmem_caches *
120 objects per cpu_cache = 140 MB
Normal: 1024 cpus * 4 bytes for pointer * 150 kmem_caches(slab merge) *
80 objects per cpu_cache = 46 MB
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slab.h')
-rw-r--r-- | mm/slab.h | 1 |
1 files changed, 0 insertions, 1 deletions
@@ -50,7 +50,6 @@ struct kmem_cache { | |||
50 | enum slab_state { | 50 | enum slab_state { |
51 | DOWN, /* No slab functionality yet */ | 51 | DOWN, /* No slab functionality yet */ |
52 | PARTIAL, /* SLUB: kmem_cache_node available */ | 52 | PARTIAL, /* SLUB: kmem_cache_node available */ |
53 | PARTIAL_ARRAYCACHE, /* SLAB: kmalloc size for arraycache available */ | ||
54 | PARTIAL_NODE, /* SLAB: kmalloc size for node struct available */ | 53 | PARTIAL_NODE, /* SLAB: kmalloc size for node struct available */ |
55 | UP, /* Slab caches usable but not all extras yet */ | 54 | UP, /* Slab caches usable but not all extras yet */ |
56 | FULL /* Everything is working */ | 55 | FULL /* Everything is working */ |