From patchwork Mon Aug 7 02:32:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 131645 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1193044vqr; Sun, 6 Aug 2023 19:53:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/nGcXFKfW/OjRWKsUUZauj06HkAbU9tz2T/RwKPqf9212pEzficFnzaZTkkDab/zRS7rn X-Received: by 2002:aca:e1d6:0:b0:3a7:3374:9a43 with SMTP id y205-20020acae1d6000000b003a733749a43mr7920964oig.57.1691376824508; Sun, 06 Aug 2023 19:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691376824; cv=none; d=google.com; s=arc-20160816; b=umO6SrnKZ5YDH32hCxfVuJ5cR0Y9egtSlqU+X3kYGZodHt8kiN7dX9uJRXBqiSfWzT JAutEXLv7hVuaD7KvJPSVZrnYEDlCHHr792vDbMNQqS6V/3rnWarWKAhQ+nQli3wriMT njPcag/E/XkOLPWiVwuserwO5tUm0drSfjv2g5GRTMrblXLKTz6SADvCI1c9iDD6vswn yL3Hi5JmhEnPsfksgk2tyL3SNg2Iqz20F3yQr9agtXYldly5SrNmrVdsIVhDYtss6kud ZkoQSaQzaKKn59oNWoKCcfXywVQMG0Bv9jg/tS6vPkHwejnJW4yuHpKBltCR6cnf7/Gg 9Hyw== 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=sBIl32qL7SE171FO2mdRqedUm7LK2AtY5vv6FocYjzQ=; fh=h7AqDXAYyImXwN82hrRd+tr0US7hUyfOr+zaT2KCj0M=; b=mV0MbMvYumFCHmk94KZ3xdE7t/QXTiukZDFYnQZwgnqk1st77nsjgU59nCPui9ngWv uarymzq3uN77vHiNZYON/JNlW5JkScnNA/2DMBzfJO0cKcf5wTVOZmAo2yQ8WyYJgZth dCgCZFGnLhqApLnbpp+CDBZA7+ue4FqdZ/i5BvLaeMUa6zabemhstNoPHtCZeMvs1MRN lHWvMYtecOtO5i7Ze5XzIVwIfidUhNKX/u6Qnr/HogyvgSekuQRFuggLsgbR9g2nsum5 Xq1FsUcw5zuOettZitHO5+Eo5BmG3Eb2/oQjoSJBJDMjw0QchM1SW2she/AIGMlqpvG/ 9Ekw== 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 205-20020a6300d6000000b0055ba5bb0bd4si4842989pga.776.2023.08.06.19.53.31; Sun, 06 Aug 2023 19:53:44 -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 S229800AbjHGCdP (ORCPT + 99 others); Sun, 6 Aug 2023 22:33:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229805AbjHGCdN (ORCPT ); Sun, 6 Aug 2023 22:33:13 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E5311722 for ; Sun, 6 Aug 2023 19:33:09 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RK0fN06qsz1Z1Tm; Mon, 7 Aug 2023 10:30:20 +0800 (CST) Received: from huawei.com (10.174.151.185) 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; Mon, 7 Aug 2023 10:33:07 +0800 From: Miaohe Lin To: , CC: , , Subject: [PATCH v2] mm/mm_init: use helper macro BITS_PER_LONG and BITS_PER_BYTE Date: Mon, 7 Aug 2023 10:32:47 +0800 Message-ID: <20230807023247.308414-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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: INBOX X-GMAIL-THRID: 1773537145366377948 X-GMAIL-MSGID: 1773537145366377948 It's more readable to use helper macro BITS_PER_LONG and BITS_PER_BYTE. No functional change intended. Signed-off-by: Miaohe Lin --- v2: use BITS_PER_BYTE per Mike. Thanks. --- mm/mm_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/mm_init.c b/mm/mm_init.c index 66aca3f6accd..93b1febd4a32 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -79,7 +79,7 @@ void __init mminit_verify_pageflags_layout(void) int shift, width; unsigned long or_mask, add_mask; - shift = 8 * sizeof(unsigned long); + shift = BITS_PER_LONG; width = shift - SECTIONS_WIDTH - NODES_WIDTH - ZONES_WIDTH - LAST_CPUPID_SHIFT - KASAN_TAG_WIDTH - LRU_GEN_WIDTH - LRU_REFS_WIDTH; mminit_dprintk(MMINIT_TRACE, "pageflags_layout_widths", @@ -1431,9 +1431,9 @@ static unsigned long __init usemap_size(unsigned long zone_start_pfn, unsigned l usemapsize = roundup(zonesize, pageblock_nr_pages); usemapsize = usemapsize >> pageblock_order; usemapsize *= NR_PAGEBLOCK_BITS; - usemapsize = roundup(usemapsize, 8 * sizeof(unsigned long)); + usemapsize = roundup(usemapsize, BITS_PER_LONG); - return usemapsize / 8; + return usemapsize / BITS_PER_BYTE; } static void __ref setup_usemap(struct zone *zone)