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: 13342949 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 6BBCAC001DF for ; Mon, 7 Aug 2023 02:33:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C933A6B0072; Sun, 6 Aug 2023 22:33:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C1B9D6B0074; Sun, 6 Aug 2023 22:33:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ABC3F8D0001; Sun, 6 Aug 2023 22:33:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 997A26B0072 for ; Sun, 6 Aug 2023 22:33:14 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 681411603A8 for ; Mon, 7 Aug 2023 02:33:14 +0000 (UTC) X-FDA: 81095736708.15.86E39F7 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf08.hostedemail.com (Postfix) with ESMTP id 07138160019 for ; Mon, 7 Aug 2023 02:33:11 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; spf=pass (imf08.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691375592; 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=sBIl32qL7SE171FO2mdRqedUm7LK2AtY5vv6FocYjzQ=; b=dUim2Qeh8Gfrefif5wonS7S/GctHIl409w3FA3pDimbFAzO1mnIToEXqmGnz16qc3XHN0h MtNVhW8IVx64/a2Vbp9kYZivatM1b0rali/N3dKxJs1YuA1QsEZBerqD+fzZGPZ7XAXis6 AeuL2ghH16ZjXOO62MqGyGRz3ixVph0= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; spf=pass (imf08.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691375592; a=rsa-sha256; cv=none; b=UTSs16JxqYE8dty11Rp4xXqC1JgcFaIAYDsoxbKcEwZAMEonusmETPS7U3++K5wn0euUYA xKX9w+TNRqyaYnFyKYoraaL4rjgVypfsS/9DwAEiemVvPkMi9XjqzRHwp2NGlSXJ7irMPu vcCC+W3Mkx5/vY7suZTgsQeHxY4o5VE= 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-Rspamd-Queue-Id: 07138160019 X-Rspam-User: X-Stat-Signature: pr5cunc9cf65u7ibdz7pyx6sye9rijjk X-Rspamd-Server: rspam01 X-HE-Tag: 1691375591-723459 X-HE-Meta: U2FsdGVkX18GgrzrLusws6FoRRyR+Xyy3t5W1cM8s3kYjPJ4GlHg6V0BtAy82/VTJvzT812oaysOoZFLUxDQGltFAKC9JkVBYa7zSXEkl7XD+UL4xvXHGjajVBAB2m1QwqM+LfLl30tK2sELMGxS6P9s0I9B4fx+40lC9tft997p2bWvWiEmnIeYagIVdB6BdzhzFLAzbDyZBlrOeNm9vl+0tKE8crPEAXra/dAcYOzRHYRC/5bl6Vj2wKevhhLYHNr+B4YYjJMOK6Q4/7sXmZcUzmG4MtZnrRSveY23xvbc9ZugQTNN+KZaO4Ou/GTnrVOO+fPYh5rA34CRMtBWai1es9D8JHKY9rGKPMwI1d4VgBunWznwmygd2nFJ52c+burI7MNpO3jRmgrwcXsaLMobQk26XcpTLcwrWv0kwxDLkiHAMYNo38SwgwLV/pkMxwQPpOy+CTG7tF6sdBD5nHVQr7u/Mnaanbk1OuHHc1fZKN+fqAJuZWYQQNey6EtV4Oxxv2oQ9MCzEz7BdpwMMRY6vVg3nHujqQfXKyWfjpB3k4Kmot4d4yd+snyWPIoYe5w4KjllC92c+S9Ht741SfFTRhf+31DO4nRBGCrdNL8aY9+w7MiQDWcC6auyro187wR+gZN50MUTizLdrzhpfs8T50omCp0o8c94GXcTKShjHsDeobk3TvUiy2m8srsWhNcN8W3p0Kg3x+dmdif4Jhiag2T0NgI8uwXAi0ex+Xdwk+Tn/Dxkkj899AlJpylhUZvCMd6vPlGLajV2Yz9HOJeBeeG2kJifijzPsMpG1Z8ufNBURLN/myqi222ow/VxLlD46vlkwmrY/RYJszfvCS/iaFbHtrXwirtofInpCkZNvHoOGbD24+ZQ+OJGsv2/q4mZwzTYtVEPuQ9C6vrfZAqibsge1DIMTWHBeUsLGBGeIvAlhJr1imjK2J0for2bH/CAZe9eMHHP2VZNWOx V6wZ/cIb /E8btWFh/j6/vpjbhln4kGcoEs4bL+F4E4fTDtU1qL7XsHH97+17hKF1LjD6KuOi1Adq63FGBuMw8Td0RWuZzYysURegRbLviELeJwyWIU/t6UZZgJRWNN1jVckkTUk5sROegjuji4rgzcxMTmg8K4jeaibZiBM/GYyuNweBX6g4I+PGa+ytpG5Fum47PnIAaZtpI 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: 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)