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: 112512 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp6710812vqr; Sat, 24 Jun 2023 20:18:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4lTIGM4hddprUbmZS6AAwdj4k1ReIQrdorUxG2K60+ITci8pYao3wPWR/MVqCJ5hd8Rb41 X-Received: by 2002:a17:902:ea04:b0:1b6:eff5:c00c with SMTP id s4-20020a170902ea0400b001b6eff5c00cmr3912552plg.40.1687663090750; Sat, 24 Jun 2023 20:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687663090; cv=none; d=google.com; s=arc-20160816; b=jgq7IQpTP41kmURmRza+Yf3FiqeeLYcP/2o0Rqabylf2cVD1vZqlZGd7h2l/PHmMTE Shvi9Qm2Iv2LUH0YwcCUvlC7A2Vc68Qd0OIf6h6+UfHtzQShW1dvCgLKMRiRnjRqDAL3 a16g1ptZahNvAVwKkhNvt3Qp8ngQ/lcpA5py4c/lZ5foCd6JduY7RIpvkt0lOeIZ23ll SR/rC7//30IHFHsneNBp6AKRgQIQ60q/hzSRSTFkIdUrNDrHNG5ovJ+yzC3EeYfTQV0i lP5DblF2MaT1cmzijCWmTPxPM99eB0cqUbDUOst8V32j41LTM7pp/TEH1i+xR5gMybhP aj9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=/N5deP4cmKsM98iwpLlsUBJFXXtIUMCNGUOoOwNfLFA=; fh=6bZpeV466oGob9rLnosJTHFFE8GMR+VhSVGRwLNiV0w=; b=DYbBB8BrBguvb4esMeu5fKEGZM1MFWphGcyLLYm50lRoKrPFegjvMHDjMxZv8VyW7c 0q+xnQh2aHK9V6IuMzg3qHpEJEkLuC8uKv5ofX82VZiDr9ssQ6dr4/bnq7FdOxJ7OTpE yt2CtzRoiD2wKVM6guNnStEYGUnkkEF2kDJAEwv62yc9dVSjvmLq4Da5POo/QDGjmgti oeUZcnuOXe7QZYoPlhrl66FxJ5pfmzlVKBGxdNbzY+cjEcGQ1SwBt/wAyuUWYoBzVppB qj5gWSy8FlMlwjklGUaOIRSMZUCQoioS9ZUq9/Ba5xjwgOOB1vujAm/rZ7zpiKRAHJd4 rJyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t19-20020a170902e1d300b001b06707ac12si1023178pla.49.2023.06.24.20.17.59; Sat, 24 Jun 2023 20:18:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231173AbjFYCOK (ORCPT + 99 others); Sat, 24 Jun 2023 22:14:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229560AbjFYCOI (ORCPT ); Sat, 24 Jun 2023 22:14:08 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 591FF11A for ; Sat, 24 Jun 2023 19:14:07 -0700 (PDT) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769643013136322274?= X-GMAIL-MSGID: =?utf-8?q?1769643013136322274?= 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);