diff options
author | Joonsoo Kim <iamjoonsoo.kim@lge.com> | 2013-10-23 21:07:49 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@iki.fi> | 2013-10-24 13:17:34 -0400 |
commit | 8456a648cf44f14365f1f44de90a3da2526a4776 (patch) | |
tree | 07504fe582df01cfb04c710ed9655e7d875ed32a /include/linux | |
parent | 106a74e13b329cf609c145dc198087c04f5f8ca5 (diff) |
slab: use struct page for slab management
Now, there are a few field in struct slab, so we can overload these
over struct page. This will save some memory and reduce cache footprint.
After this change, slabp_cache and slab_size no longer related to
a struct slab, so rename them as freelist_cache and freelist_size.
These changes are just mechanical ones and there is no functional change.
Acked-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Pekka Enberg <penberg@iki.fi>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/mm_types.h | 21 | ||||
-rw-r--r-- | include/linux/slab_def.h | 4 |
2 files changed, 15 insertions, 10 deletions
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 959cb369b197..95bf0c5a7eb9 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -42,18 +42,22 @@ struct page { | |||
42 | /* First double word block */ | 42 | /* First double word block */ |
43 | unsigned long flags; /* Atomic flags, some possibly | 43 | unsigned long flags; /* Atomic flags, some possibly |
44 | * updated asynchronously */ | 44 | * updated asynchronously */ |
45 | struct address_space *mapping; /* If low bit clear, points to | 45 | union { |
46 | * inode address_space, or NULL. | 46 | struct address_space *mapping; /* If low bit clear, points to |
47 | * If page mapped as anonymous | 47 | * inode address_space, or NULL. |
48 | * memory, low bit is set, and | 48 | * If page mapped as anonymous |
49 | * it points to anon_vma object: | 49 | * memory, low bit is set, and |
50 | * see PAGE_MAPPING_ANON below. | 50 | * it points to anon_vma object: |
51 | */ | 51 | * see PAGE_MAPPING_ANON below. |
52 | */ | ||
53 | void *s_mem; /* slab first object */ | ||
54 | }; | ||
55 | |||
52 | /* Second double word */ | 56 | /* Second double word */ |
53 | struct { | 57 | struct { |
54 | union { | 58 | union { |
55 | pgoff_t index; /* Our offset within mapping. */ | 59 | pgoff_t index; /* Our offset within mapping. */ |
56 | void *freelist; /* slub/slob first free object */ | 60 | void *freelist; /* sl[aou]b first free object */ |
57 | bool pfmemalloc; /* If set by the page allocator, | 61 | bool pfmemalloc; /* If set by the page allocator, |
58 | * ALLOC_NO_WATERMARKS was set | 62 | * ALLOC_NO_WATERMARKS was set |
59 | * and the low watermark was not | 63 | * and the low watermark was not |
@@ -109,6 +113,7 @@ struct page { | |||
109 | }; | 113 | }; |
110 | atomic_t _count; /* Usage count, see below. */ | 114 | atomic_t _count; /* Usage count, see below. */ |
111 | }; | 115 | }; |
116 | unsigned int active; /* SLAB */ | ||
112 | }; | 117 | }; |
113 | }; | 118 | }; |
114 | 119 | ||
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index cd401580bdd3..ca82e8ff89fa 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h | |||
@@ -41,8 +41,8 @@ struct kmem_cache { | |||
41 | 41 | ||
42 | size_t colour; /* cache colouring range */ | 42 | size_t colour; /* cache colouring range */ |
43 | unsigned int colour_off; /* colour offset */ | 43 | unsigned int colour_off; /* colour offset */ |
44 | struct kmem_cache *slabp_cache; | 44 | struct kmem_cache *freelist_cache; |
45 | unsigned int slab_size; | 45 | unsigned int freelist_size; |
46 | 46 | ||
47 | /* constructor func */ | 47 | /* constructor func */ |
48 | void (*ctor)(void *obj); | 48 | void (*ctor)(void *obj); |