Skip to content

Commit ae664db

Browse files
committed
Merge branch 'slab/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/linux
Pull SLAB changes from Pekka Enberg: "This contains preparational work from Christoph Lameter and Glauber Costa for SLAB memcg and cleanups and improvements from Ezequiel Garcia and Joonsoo Kim. Please note that the SLOB cleanup commit from Arnd Bergmann already appears in your tree but I had also merged it myself which is why it shows up in the shortlog." * 'slab/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/linux: mm/sl[aou]b: Common alignment code slab: Use the new create_boot_cache function to simplify bootstrap slub: Use statically allocated kmem_cache boot structure for bootstrap mm, sl[au]b: create common functions for boot slab creation slab: Simplify bootstrap slub: Use correct cpu_slab on dead cpu mm: fix slab.c kernel-doc warnings mm/slob: use min_t() to compare ARCH_SLAB_MINALIGN slab: Ignore internal flags in cache creation mm/slob: Use free_page instead of put_page for page-size kmalloc allocations mm/sl[aou]b: Move common kmem_cache_size() to slab.h mm/slob: Use object_size field in kmem_cache_size() mm/slob: Drop usage of page->private for storing page-sized allocations slub: Commonize slab_cache field in struct page sl[au]b: Process slabinfo_show in common code mm/sl[au]b: Move print_slabinfo_header to slab_common.c mm/sl[au]b: Move slabinfo processing to slab_common.c slub: remove one code path and reduce lock contention in __slab_free()
2 parents a2faf2f + 08afe22 commit ae664db

File tree

8 files changed

+402
-491
lines changed

8 files changed

+402
-491
lines changed

include/linux/mm_types.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,7 @@ struct page {
128128
};
129129

130130
struct list_head list; /* slobs list of pages */
131-
struct { /* slab fields */
132-
struct kmem_cache *slab_cache;
133-
struct slab *slab_page;
134-
};
131+
struct slab *slab_page; /* slab fields */
135132
};
136133

137134
/* Remainder is not double word aligned */
@@ -146,7 +143,7 @@ struct page {
146143
#if USE_SPLIT_PTLOCKS
147144
spinlock_t ptl;
148145
#endif
149-
struct kmem_cache *slab; /* SLUB: Pointer to slab */
146+
struct kmem_cache *slab_cache; /* SL[AU]B: Pointer to slab */
150147
struct page *first_page; /* Compound tail pages */
151148
};
152149

include/linux/slab.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
128128
void kmem_cache_destroy(struct kmem_cache *);
129129
int kmem_cache_shrink(struct kmem_cache *);
130130
void kmem_cache_free(struct kmem_cache *, void *);
131-
unsigned int kmem_cache_size(struct kmem_cache *);
132131

133132
/*
134133
* Please use this macro to create slab caches. Simply specify the
@@ -388,6 +387,14 @@ static inline void *kzalloc_node(size_t size, gfp_t flags, int node)
388387
return kmalloc_node(size, flags | __GFP_ZERO, node);
389388
}
390389

390+
/*
391+
* Determine the size of a slab object
392+
*/
393+
static inline unsigned int kmem_cache_size(struct kmem_cache *s)
394+
{
395+
return s->object_size;
396+
}
397+
391398
void __init kmem_cache_init_late(void);
392399

393400
#endif /* _LINUX_SLAB_H */

include/linux/slab_def.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,13 @@ struct kmem_cache {
8989
* (see kmem_cache_init())
9090
* We still use [NR_CPUS] and not [1] or [0] because cache_cache
9191
* is statically defined, so we reserve the max number of cpus.
92+
*
93+
* We also need to guarantee that the list is able to accomodate a
94+
* pointer for each node since "nodelists" uses the remainder of
95+
* available pointers.
9296
*/
9397
struct kmem_list3 **nodelists;
94-
struct array_cache *array[NR_CPUS];
98+
struct array_cache *array[NR_CPUS + MAX_NUMNODES];
9599
/*
96100
* Do not add fields after array[]
97101
*/

0 commit comments

Comments
 (0)