mm/mm_init.c: remove obsolete macro HASH_SMALL
authorMiaohe Lin <linmiaohe@huawei.com>
Sun, 25 Jun 2023 02:13:23 +0000 (10:13 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 18 Aug 2023 17:12:07 +0000 (10:12 -0700)
HASH_SMALL only works when parameter numentries is 0. But the sole caller
futex_init() never calls alloc_large_system_hash() with numentries set to
0. So HASH_SMALL is obsolete and remove it.

Link: https://lkml.kernel.org/r/20230625021323.849147-1-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: André Almeida <andrealmeid@igalia.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/memblock.h
kernel/futex/core.c
mm/mm_init.c

index f71ff9f..0d031fb 100644 (file)
@@ -581,9 +581,7 @@ extern void *alloc_large_system_hash(const char *tablename,
                                     unsigned long high_limit);
 
 #define HASH_EARLY     0x00000001      /* Allocating during early boot? */
-#define HASH_SMALL     0x00000002      /* sub-page allocation allowed, min
-                                        * shift passed via *_hash_shift */
-#define HASH_ZERO      0x00000004      /* Zero allocated hash table */
+#define HASH_ZERO      0x00000002      /* Zero allocated hash table */
 
 /* Only NUMA needs hash distribution. 64bit NUMA architectures have
  * sufficient vmalloc space.
index 514e458..f10587d 100644 (file)
@@ -1132,8 +1132,7 @@ static int __init futex_init(void)
 #endif
 
        futex_queues = alloc_large_system_hash("futex", sizeof(*futex_queues),
-                                              futex_hashsize, 0,
-                                              futex_hashsize < 256 ? HASH_SMALL : 0,
+                                              futex_hashsize, 0, 0,
                                               &futex_shift, NULL,
                                               futex_hashsize, futex_hashsize);
        futex_hashsize = 1UL << futex_shift;
index d356ba5..f90db54 100644 (file)
@@ -2489,15 +2489,7 @@ void *__init alloc_large_system_hash(const char *tablename,
                else
                        numentries <<= (PAGE_SHIFT - scale);
 
-               /* Make sure we've got at least a 0-order allocation.. */
-               if (unlikely(flags & HASH_SMALL)) {
-                       /* Makes no sense without HASH_EARLY */
-                       WARN_ON(!(flags & HASH_EARLY));
-                       if (!(numentries >> *_hash_shift)) {
-                               numentries = 1UL << *_hash_shift;
-                               BUG_ON(!numentries);
-                       }
-               } else if (unlikely((numentries * bucketsize) < PAGE_SIZE))
+               if (unlikely((numentries * bucketsize) < PAGE_SIZE))
                        numentries = PAGE_SIZE / bucketsize;
        }
        numentries = roundup_pow_of_two(numentries);