diff options
author | Christoph Lameter <clameter@sgi.com> | 2007-07-17 07:03:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 13:23:01 -0400 |
commit | 0c710013200e72b5e0bc680ff4ec6bdac53c5ce8 (patch) | |
tree | 160c44e8036e9ea65e7863271f925954d05ed091 | |
parent | d07dbea46405b37d59495eb4de9d1056dcfb7c6d (diff) |
SLUB: add some more inlines and #ifdef CONFIG_SLUB_DEBUG
Add #ifdefs around data structures only needed if debugging is compiled into
SLUB.
Add inlines to small functions to reduce code size.
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>
-rw-r--r-- | include/linux/slub_def.h | 4 | ||||
-rw-r--r-- | mm/slub.c | 13 |
2 files changed, 11 insertions, 6 deletions
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 579b0a22858e..bae11111458f 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
@@ -16,7 +16,9 @@ struct kmem_cache_node { | |||
16 | unsigned long nr_partial; | 16 | unsigned long nr_partial; |
17 | atomic_long_t nr_slabs; | 17 | atomic_long_t nr_slabs; |
18 | struct list_head partial; | 18 | struct list_head partial; |
19 | #ifdef CONFIG_SLUB_DEBUG | ||
19 | struct list_head full; | 20 | struct list_head full; |
21 | #endif | ||
20 | }; | 22 | }; |
21 | 23 | ||
22 | /* | 24 | /* |
@@ -44,7 +46,9 @@ struct kmem_cache { | |||
44 | int align; /* Alignment */ | 46 | int align; /* Alignment */ |
45 | const char *name; /* Name (only for display!) */ | 47 | const char *name; /* Name (only for display!) */ |
46 | struct list_head list; /* List of slab caches */ | 48 | struct list_head list; /* List of slab caches */ |
49 | #ifdef CONFIG_SLUB_DEBUG | ||
47 | struct kobject kobj; /* For sysfs */ | 50 | struct kobject kobj; /* For sysfs */ |
51 | #endif | ||
48 | 52 | ||
49 | #ifdef CONFIG_NUMA | 53 | #ifdef CONFIG_NUMA |
50 | int defrag_ratio; | 54 | int defrag_ratio; |
@@ -252,9 +252,10 @@ static int sysfs_slab_add(struct kmem_cache *); | |||
252 | static int sysfs_slab_alias(struct kmem_cache *, const char *); | 252 | static int sysfs_slab_alias(struct kmem_cache *, const char *); |
253 | static void sysfs_slab_remove(struct kmem_cache *); | 253 | static void sysfs_slab_remove(struct kmem_cache *); |
254 | #else | 254 | #else |
255 | static int sysfs_slab_add(struct kmem_cache *s) { return 0; } | 255 | static inline int sysfs_slab_add(struct kmem_cache *s) { return 0; } |
256 | static int sysfs_slab_alias(struct kmem_cache *s, const char *p) { return 0; } | 256 | static inline int sysfs_slab_alias(struct kmem_cache *s, const char *p) |
257 | static void sysfs_slab_remove(struct kmem_cache *s) {} | 257 | { return 0; } |
258 | static inline void sysfs_slab_remove(struct kmem_cache *s) {} | ||
258 | #endif | 259 | #endif |
259 | 260 | ||
260 | /******************************************************************** | 261 | /******************************************************************** |
@@ -1395,7 +1396,7 @@ static void deactivate_slab(struct kmem_cache *s, struct page *page, int cpu) | |||
1395 | unfreeze_slab(s, page); | 1396 | unfreeze_slab(s, page); |
1396 | } | 1397 | } |
1397 | 1398 | ||
1398 | static void flush_slab(struct kmem_cache *s, struct page *page, int cpu) | 1399 | static inline void flush_slab(struct kmem_cache *s, struct page *page, int cpu) |
1399 | { | 1400 | { |
1400 | slab_lock(page); | 1401 | slab_lock(page); |
1401 | deactivate_slab(s, page, cpu); | 1402 | deactivate_slab(s, page, cpu); |
@@ -1405,7 +1406,7 @@ static void flush_slab(struct kmem_cache *s, struct page *page, int cpu) | |||
1405 | * Flush cpu slab. | 1406 | * Flush cpu slab. |
1406 | * Called from IPI handler with interrupts disabled. | 1407 | * Called from IPI handler with interrupts disabled. |
1407 | */ | 1408 | */ |
1408 | static void __flush_cpu_slab(struct kmem_cache *s, int cpu) | 1409 | static inline void __flush_cpu_slab(struct kmem_cache *s, int cpu) |
1409 | { | 1410 | { |
1410 | struct page *page = s->cpu_slab[cpu]; | 1411 | struct page *page = s->cpu_slab[cpu]; |
1411 | 1412 | ||
@@ -2165,7 +2166,7 @@ static int free_list(struct kmem_cache *s, struct kmem_cache_node *n, | |||
2165 | /* | 2166 | /* |
2166 | * Release all resources used by a slab cache. | 2167 | * Release all resources used by a slab cache. |
2167 | */ | 2168 | */ |
2168 | static int kmem_cache_close(struct kmem_cache *s) | 2169 | static inline int kmem_cache_close(struct kmem_cache *s) |
2169 | { | 2170 | { |
2170 | int node; | 2171 | int node; |
2171 | 2172 | ||