Skip to content

Commit

Permalink
slab: make create_boot_cache() work with 32-bit sizes
Browse files Browse the repository at this point in the history
struct kmem_cache::size has always been "int", all those
"size_t size" are fake.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Alexey Dobriyan <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Alexey Dobriyan authored and torvalds committed Apr 6, 2018
1 parent 55de8b9 commit 361d575
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions mm/slab.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ struct kmem_cache *create_kmalloc_cache(const char *name, unsigned int size,
slab_flags_t flags, unsigned int useroffset,
unsigned int usersize);
extern void create_boot_cache(struct kmem_cache *, const char *name,
size_t size, slab_flags_t flags, size_t useroffset,
size_t usersize);
unsigned int size, slab_flags_t flags,
unsigned int useroffset, unsigned int usersize);

int slab_unmergeable(struct kmem_cache *s);
struct kmem_cache *find_mergeable(size_t size, size_t align,
Expand Down
7 changes: 4 additions & 3 deletions mm/slab_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,8 +917,9 @@ bool slab_is_available(void)

#ifndef CONFIG_SLOB
/* Create a cache during boot when no slab services are available yet */
void __init create_boot_cache(struct kmem_cache *s, const char *name, size_t size,
slab_flags_t flags, size_t useroffset, size_t usersize)
void __init create_boot_cache(struct kmem_cache *s, const char *name,
unsigned int size, slab_flags_t flags,
unsigned int useroffset, unsigned int usersize)
{
int err;

Expand All @@ -933,7 +934,7 @@ void __init create_boot_cache(struct kmem_cache *s, const char *name, size_t siz
err = __kmem_cache_create(s, flags);

if (err)
panic("Creation of kmalloc slab %s size=%zu failed. Reason %d\n",
panic("Creation of kmalloc slab %s size=%u failed. Reason %d\n",
name, size, err);

s->refcount = -1; /* Exempt from merging for now */
Expand Down

0 comments on commit 361d575

Please sign in to comment.