[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210508221328.7338-1-42.hyeyoo@gmail.com>
Date: Sun, 9 May 2021 07:13:28 +0900
From: Hyeonggon Yoo <42.hyeyoo@...il.com>
To: cl@...ux.com, penberg@...nel.org, rientjes@...gle.com,
iamjoonsoo.kim@....com, vbabka@...e.cz
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Hyeonggon Yoo <42.hyeyoo@...il.com>
Subject: [PATCH] mm: kmalloc_index: remove case when size is more than 32MB
the return value of kmalloc_index is used as index of kmalloc_caches,
which is defined as:
struct kmem_cache *
kmalloc_caches[NR_KMALLOC_TYPES][KMALLOC_SHIFT_HIGH + 1]
and KMALLOC_SHIFT_HIGH is defined as:
#define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \
(MAX_ORDER + PAGE_SHIFT - 1) : 25)
KMALLOC_SHIFT_HIGH is maximum 25 by its definition. thus index of
kmalloc_caches cannot be 26. so this case should be removed.
Signed-off-by: Hyeonggon Yoo <42.hyeyoo@...il.com>
---
include/linux/slab.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 0c97d788762c..4694b1db4cb2 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -382,7 +382,6 @@ static __always_inline unsigned int kmalloc_index(size_t size)
if (size <= 8 * 1024 * 1024) return 23;
if (size <= 16 * 1024 * 1024) return 24;
if (size <= 32 * 1024 * 1024) return 25;
- if (size <= 64 * 1024 * 1024) return 26;
BUG();
/* Will never be reached. Needed because the compiler may complain */
--
2.25.1
Powered by blists - more mailing lists