Commit 8456a648 authored by Joonsoo Kim's avatar Joonsoo Kim Committed by Pekka Enberg
Browse files

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: default avatarAndi Kleen <ak@linux.intel.com>
Acked-by: default avatarChristoph Lameter <cl@linux.com>
Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: default avatarPekka Enberg <penberg@iki.fi>
parent 106a74e1
...@@ -42,18 +42,22 @@ struct page { ...@@ -42,18 +42,22 @@ struct page {
/* First double word block */ /* First double word block */
unsigned long flags; /* Atomic flags, some possibly unsigned long flags; /* Atomic flags, some possibly
* updated asynchronously */ * updated asynchronously */
struct address_space *mapping; /* If low bit clear, points to union {
* inode address_space, or NULL. struct address_space *mapping; /* If low bit clear, points to
* If page mapped as anonymous * inode address_space, or NULL.
* memory, low bit is set, and * If page mapped as anonymous
* it points to anon_vma object: * memory, low bit is set, and
* see PAGE_MAPPING_ANON below. * it points to anon_vma object:
*/ * see PAGE_MAPPING_ANON below.
*/
void *s_mem; /* slab first object */
};
/* Second double word */ /* Second double word */
struct { struct {
union { union {
pgoff_t index; /* Our offset within mapping. */ pgoff_t index; /* Our offset within mapping. */
void *freelist; /* slub/slob first free object */ void *freelist; /* sl[aou]b first free object */
bool pfmemalloc; /* If set by the page allocator, bool pfmemalloc; /* If set by the page allocator,
* ALLOC_NO_WATERMARKS was set * ALLOC_NO_WATERMARKS was set
* and the low watermark was not * and the low watermark was not
...@@ -109,6 +113,7 @@ struct page { ...@@ -109,6 +113,7 @@ struct page {
}; };
atomic_t _count; /* Usage count, see below. */ atomic_t _count; /* Usage count, see below. */
}; };
unsigned int active; /* SLAB */
}; };
}; };
......
...@@ -41,8 +41,8 @@ struct kmem_cache { ...@@ -41,8 +41,8 @@ struct kmem_cache {
size_t colour; /* cache colouring range */ size_t colour; /* cache colouring range */
unsigned int colour_off; /* colour offset */ unsigned int colour_off; /* colour offset */
struct kmem_cache *slabp_cache; struct kmem_cache *freelist_cache;
unsigned int slab_size; unsigned int freelist_size;
/* constructor func */ /* constructor func */
void (*ctor)(void *obj); void (*ctor)(void *obj);
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment