From patchwork Sun Jun 25 02:13:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13291823 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59BEEEB64DD for ; Sun, 25 Jun 2023 02:14:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A898D8D0002; Sat, 24 Jun 2023 22:14:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A12CB8D0001; Sat, 24 Jun 2023 22:14:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D9808D0002; Sat, 24 Jun 2023 22:14:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 7B9E88D0001 for ; Sat, 24 Jun 2023 22:14:13 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2195614068A for ; Sun, 25 Jun 2023 02:14:13 +0000 (UTC) X-FDA: 80939650386.07.38787F1 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf06.hostedemail.com (Postfix) with ESMTP id 82FBB180009 for ; Sun, 25 Jun 2023 02:14:09 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf06.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687659251; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=/N5deP4cmKsM98iwpLlsUBJFXXtIUMCNGUOoOwNfLFA=; b=DK/Vxoc71fN9Q4i+JeI8MB9MmarnqAOYQIRShKAX6E/rDCPOUOlEeso7CsZj+z01b8XXgp 6s6C0urQ4TEC2RjoBDO/bnMZQUX4qfJuk6qGqUHE+UoY5+fE6J3FO4e7LuB+AK0ZchQW5B NAoI+1w1266dHbBeeObGJv6/G9CHI9c= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf06.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687659251; a=rsa-sha256; cv=none; b=eZZtEej3IBMPF1Jn04zMEoa26t4lZDwwZ5x3VggMiU5FluBr2AOfIQvvGmHCxu0NStBh4S IItnp4bmpHjbLRd8AHtDeaqpVmedVilaP0+i31KqUMXYaDZZwOY1UR4wAGxxkif4NTbBd2 u35DZ9MIU8dsD9H2jXko8mA6sWIhIRE= Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QpZGN0TdgztQmQ; Sun, 25 Jun 2023 10:11:24 +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.27; Sun, 25 Jun 2023 10:14:04 +0800 From: Miaohe Lin To: , , , CC: , , , , , , Subject: [PATCH v2] mm/mm_init.c: remove obsolete macro HASH_SMALL Date: Sun, 25 Jun 2023 10:13:23 +0800 Message-ID: <20230625021323.849147-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Originating-IP: [10.175.104.170] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 82FBB180009 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 6hsh1cztw9fh1qiy56jodecno6snmyyn X-HE-Tag: 1687659249-108320 X-HE-Meta: U2FsdGVkX1+Gru2v9TDI9Th15myHYtkK/456hO0ao0qxp26X6g3671Ri0JzhT4CdJW38ha7EweuHlxpIhoZr4N/sfHO5zSHg+C8xhn8YtEmMiNyfq7KUAtX8B4rscphsbUaDJEfrOnQ+Y1TQYQXiOjYLeIt1qJ+9kDHDAxBRlDKWnDl6r14fIhaw+IUIY8DmWZ5q1JDvOlf5dk/7ldmhSPNs2giCgLNqBdM5op3147Tpk8gHD5Yi3F8UtMSHkJzJGSXr9AP+T/czwGlBjavCrvkmxO3XCakYkY1oyAdAKojE0+XJgWothTui/uwOewbbrFJUjlNXRz7Ut5JcMGmNPlJTUtPHIweMNt4SxzM93G5Jgyy7T6BHxhetJC6bo+zz5SBRV9WU/7rTWVu6gCDZS5jPdC1RpQ0tXmVpvBVyrofSP6WCJ7QxTlCiihhZbS2Xksa7xBX7LhdlFVIcvhKJbtEyaE+sqh4FfdfbDVl9hFvz3UAX+8HOpeANrkEgs4DY32KA2A8ymumyGD+FRUfPxuoUf4Rw5MVyxCJq2NHmnngATvLvWWuziaH5YLHpWTEbH4WPcIk25/yaCKp5nGKa2yNby6/Wdt5hx4KDkJ06hHZ1NmZFTE5fWoaBQuat5VKpe5jR31dRbZAIYDioLBu4Fp/iJmLJudz0CFqHUODurewQJv0ntaNxwQH1zUfIwn2RfgN/A+hhlgjLqjovtzjL2DvzOC0VzescbGi1lHEeohwuTTZ1kTaAU/SO7lu4SpbJEA98fkEUYr4TkXQq+deCcFR36a+dHPPTv0ZWQg0SNggUJnyCL64wGFTyHgR8gPGesDojhMztdCtZvo4zAmAK2sWye7J9SIfJPPp+sM+ZZ80JvtgLoxMnAsLdz/2Ys2aoEfZDj/C7z6nkE7Ueu3eeR6YL04p+x+ExIkvK/rfW3DSKxFpgVuCajeZjteP5n6JysjXnAgbS4fwsJ1bk8Ak Xsmj/+HI GqTo787Uln6JvHkxN4KSi5eEQymz7G9vslHwjasneWDShZDmfaAsINUg67HaX7np0sjt43yKs6CQGWkw5gUcAsJ/nBgseiwhLjvErpBGdRkCoQs2HOT4WETqUUsmphIPzpUvlw5PXXRho3oi29UC2iUDJAZN/gOSKsKEgjmOFsrBzYbuoBU4SOZpVYDzW3WtpLZoQ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: Mike Rapoport (IBM) --- v2: update HASH_ZERO to 0x2 per Mike --- include/linux/memblock.h | 4 +--- kernel/futex/core.c | 3 +-- mm/mm_init.c | 10 +--------- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index f71ff9f0ec81..0d031fbfea25 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -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. 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 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; diff --git a/mm/mm_init.c b/mm/mm_init.c index a1963c3322af..999723dee8cc 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -2490,15 +2490,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);