From: Alexey Dobriyan Date: Mon, 28 Jan 2019 19:31:17 +0000 (-0800) Subject: slub: make ->cpu_partial unsigned X-Git-Tag: v4.1.12-124.31.3~281 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cfc59a43b7fda8745aca747f9c80c07575edb387;p=users%2Fjedix%2Flinux-maple.git slub: make ->cpu_partial unsigned /* * cpu_partial determined the maximum number of objects * kept in the per cpu partial lists of a processor. */ Can't be negative. Orabug: 28620592 We can't reproduce the issue, this patch is expected to help in theory. Link: http://lkml.kernel.org/r/20180305200730.15812-15-adobriyan@gmail.com Signed-off-by: Alexey Dobriyan Acked-by: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: zhong jiang Signed-off-by: Greg Kroah-Hartman Signed-off-by: Wengang Wang Reviewed-by: John Sobecki Signed-off-by: Brian Maly --- diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 33885118523c..311cb45124b7 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h @@ -67,7 +67,8 @@ struct kmem_cache { int size; /* The size of an object including meta data */ int object_size; /* The size of an object without meta data */ int offset; /* Free pointer offset. */ - int cpu_partial; /* Number of per cpu partial objects to keep around */ + /* Number of per cpu partial objects to keep around */ + UEK_KABI_REPLACE(int cpu_partial, unsigned int cpu_partial) struct kmem_cache_order_objects oo; /* Allocation and freeing of slabs */ diff --git a/mm/slub.c b/mm/slub.c index 3d7932cc7084..0419962fff24 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1619,7 +1619,7 @@ static void *get_partial_node(struct kmem_cache *s, struct kmem_cache_node *n, { struct page *page, *page2; void *object = NULL; - int available = 0; + unsigned int available = 0; int objects; /* @@ -4460,10 +4460,10 @@ static ssize_t cpu_partial_show(struct kmem_cache *s, char *buf) static ssize_t cpu_partial_store(struct kmem_cache *s, const char *buf, size_t length) { - unsigned long objects; + unsigned int objects; int err; - err = kstrtoul(buf, 10, &objects); + err = kstrtouint(buf, 10, &objects); if (err) return err; if (objects && !kmem_cache_has_cpu_partial(s))