lkml.org 
[lkml]   [2021]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mm: kmalloc_index: remove case when size is more than 32MB
Date
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@gmail.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
\
 
 \ /
  Last update: 2021-05-09 00:14    [W:0.094 / U:0.960 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site