From nobody Sun Feb 8 10:33:25 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88E16EB64D9 for ; Sat, 17 Jun 2023 07:10:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234335AbjFQHKg (ORCPT ); Sat, 17 Jun 2023 03:10:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231929AbjFQHKd (ORCPT ); Sat, 17 Jun 2023 03:10:33 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50417211D for ; Sat, 17 Jun 2023 00:10:31 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QjnD73DZ4ztQVr; Sat, 17 Jun 2023 15:07:51 +0800 (CST) Received: from huawei.com (10.175.104.170) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Sat, 17 Jun 2023 15:10:23 +0800 From: Miaohe Lin To: , , , CC: , , , , , , Subject: [PATCH] mm/mm_init.c: remove obsolete macro HASH_SMALL Date: Sat, 17 Jun 2023 15:09:55 +0800 Message-ID: <20230617070955.1751393-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.104.170] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Miaohe Lin --- include/linux/memblock.h | 2 -- kernel/futex/core.c | 3 +-- mm/mm_init.c | 10 +--------- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index f71ff9f0ec81..346d80809517 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -581,8 +581,6 @@ extern void *alloc_large_system_hash(const char *tablen= ame, unsigned long high_limit); =20 #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 */ =20 /* Only NUMA needs hash distribution. 64bit NUMA architectures have diff --git a/kernel/futex/core.c b/kernel/futex/core.c index 514e4582b863..f10587d1d481 100644 --- a/kernel/futex/core.c +++ b/kernel/futex/core.c @@ -1132,8 +1132,7 @@ static int __init futex_init(void) #endif =20 futex_queues =3D 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 =3D 1UL << futex_shift; diff --git a/mm/mm_init.c b/mm/mm_init.c index d393631599a7..fab3c4649d5b 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -2492,15 +2492,7 @@ void *__init alloc_large_system_hash(const char *tab= lename, else numentries <<=3D (PAGE_SHIFT - scale); =20 - /* 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 =3D 1UL << *_hash_shift; - BUG_ON(!numentries); - } - } else if (unlikely((numentries * bucketsize) < PAGE_SIZE)) + if (unlikely((numentries * bucketsize) < PAGE_SIZE)) numentries =3D PAGE_SIZE / bucketsize; } numentries =3D roundup_pow_of_two(numentries); --=20 2.27.0