diff options
author | Christoph Lameter <cl@linux.com> | 2012-07-06 16:25:11 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2012-07-09 05:13:35 -0400 |
commit | 97d06609158e61f6bdf538c4a6788e2de492236f (patch) | |
tree | fa3f57ff3e2d3f4f866d84dd9d634ade43941be8 /mm/slub.c | |
parent | 039363f38bfe5f6281e9eae5e0518b11577d9d50 (diff) |
mm, sl[aou]b: Common definition for boot state of the slab allocators
All allocators have some sort of support for the bootstrap status.
Setup a common definition for the boot states and make all slab
allocators use that definition.
Reviewed-by: Glauber Costa <glommer@parallels.com>
Reviewed-by: Joonsoo Kim <js1304@gmail.com>
Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slub.c')
-rw-r--r-- | mm/slub.c | 21 |
1 files changed, 5 insertions, 16 deletions
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/bitops.h> | 17 | #include <linux/bitops.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include "slab.h" | ||
19 | #include <linux/proc_fs.h> | 20 | #include <linux/proc_fs.h> |
20 | #include <linux/seq_file.h> | 21 | #include <linux/seq_file.h> |
21 | #include <linux/kmemcheck.h> | 22 | #include <linux/kmemcheck.h> |
@@ -182,13 +183,6 @@ static int kmem_size = sizeof(struct kmem_cache); | |||
182 | static struct notifier_block slab_notifier; | 183 | static struct notifier_block slab_notifier; |
183 | #endif | 184 | #endif |
184 | 185 | ||
185 | static enum { | ||
186 | DOWN, /* No slab functionality available */ | ||
187 | PARTIAL, /* Kmem_cache_node works */ | ||
188 | UP, /* Everything works but does not show up in sysfs */ | ||
189 | SYSFS /* Sysfs up */ | ||
190 | } slab_state = DOWN; | ||
191 | |||
192 | /* A list of all slab caches on the system */ | 186 | /* A list of all slab caches on the system */ |
193 | static DECLARE_RWSEM(slub_lock); | 187 | static DECLARE_RWSEM(slub_lock); |
194 | static LIST_HEAD(slab_caches); | 188 | static LIST_HEAD(slab_caches); |
@@ -237,11 +231,6 @@ static inline void stat(const struct kmem_cache *s, enum stat_item si) | |||
237 | * Core slab cache functions | 231 | * Core slab cache functions |
238 | *******************************************************************/ | 232 | *******************************************************************/ |
239 | 233 | ||
240 | int slab_is_available(void) | ||
241 | { | ||
242 | return slab_state >= UP; | ||
243 | } | ||
244 | |||
245 | static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node) | 234 | static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node) |
246 | { | 235 | { |
247 | return s->node[node]; | 236 | return s->node[node]; |
@@ -5274,7 +5263,7 @@ static int sysfs_slab_add(struct kmem_cache *s) | |||
5274 | const char *name; | 5263 | const char *name; |
5275 | int unmergeable; | 5264 | int unmergeable; |
5276 | 5265 | ||
5277 | if (slab_state < SYSFS) | 5266 | if (slab_state < FULL) |
5278 | /* Defer until later */ | 5267 | /* Defer until later */ |
5279 | return 0; | 5268 | return 0; |
5280 | 5269 | ||
@@ -5319,7 +5308,7 @@ static int sysfs_slab_add(struct kmem_cache *s) | |||
5319 | 5308 | ||
5320 | static void sysfs_slab_remove(struct kmem_cache *s) | 5309 | static void sysfs_slab_remove(struct kmem_cache *s) |
5321 | { | 5310 | { |
5322 | if (slab_state < SYSFS) | 5311 | if (slab_state < FULL) |
5323 | /* | 5312 | /* |
5324 | * Sysfs has not been setup yet so no need to remove the | 5313 | * Sysfs has not been setup yet so no need to remove the |
5325 | * cache from sysfs. | 5314 | * cache from sysfs. |
@@ -5347,7 +5336,7 @@ static int sysfs_slab_alias(struct kmem_cache *s, const char *name) | |||
5347 | { | 5336 | { |
5348 | struct saved_alias *al; | 5337 | struct saved_alias *al; |
5349 | 5338 | ||
5350 | if (slab_state == SYSFS) { | 5339 | if (slab_state == FULL) { |
5351 | /* | 5340 | /* |
5352 | * If we have a leftover link then remove it. | 5341 | * If we have a leftover link then remove it. |
5353 | */ | 5342 | */ |
@@ -5380,7 +5369,7 @@ static int __init slab_sysfs_init(void) | |||
5380 | return -ENOSYS; | 5369 | return -ENOSYS; |
5381 | } | 5370 | } |
5382 | 5371 | ||
5383 | slab_state = SYSFS; | 5372 | slab_state = FULL; |
5384 | 5373 | ||
5385 | list_for_each_entry(s, &slab_caches, list) { | 5374 | list_for_each_entry(s, &slab_caches, list) { |
5386 | err = sysfs_slab_add(s); | 5375 | err = sysfs_slab_add(s); |