From patchwork Mon Aug 7 02:35:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13342950 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 5867FC0015E for ; Mon, 7 Aug 2023 02:35:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E42876B0074; Sun, 6 Aug 2023 22:35:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF2D06B0075; Sun, 6 Aug 2023 22:35:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CBA538D0001; Sun, 6 Aug 2023 22:35:55 -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 B97CF6B0074 for ; Sun, 6 Aug 2023 22:35:55 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 900C01C941C for ; Mon, 7 Aug 2023 02:35:55 +0000 (UTC) X-FDA: 81095743470.16.262D1D9 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf16.hostedemail.com (Postfix) with ESMTP id B607E180004 for ; Mon, 7 Aug 2023 02:35:52 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf16.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 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=1691375753; 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=rlJutPsbvY51rGhmnYEgexjqdDHgarVo+CQn5G/C4SY=; b=HjysV8iGG8tDxphCa2FwIOl+Kpl+ezC3EZCEwexaTH881BKuBdsro5ecfWsg2a+kedeRbk NwEmCVn9DWb+KaNTOx5geLkulj/4Ch//yTee/ItYzoptJ1joSoOw76PiHCrVRRkaQEWKvm ms19w7Y/MSkSmiwlZtWy+51a/xUg+/Y= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf16.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691375753; a=rsa-sha256; cv=none; b=KEWOlAcnNvVhXxFHwa4IJL3YQTeV673j88+MpPPE3YMJIB3gKvkxQlPpyrtEFMxDmmiVVV sSlAQCfEug4SFF3PkAhWzkq2Boe2z32NC1/OWcQs+QNF5erTfyZpE74Ty6Q1NtGDmZo4ca PJ5lLil712Uti+F1auhGIrUEpNTkRHY= Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RK0kY4ttqzVk0x; Mon, 7 Aug 2023 10:33:57 +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:35:48 +0800 From: Miaohe Lin To: , CC: , , , Subject: [PATCH RESEND v2] mm/mm_init: use helper macro BITS_PER_LONG and BITS_PER_BYTE Date: Mon, 7 Aug 2023 10:35:28 +0800 Message-ID: <20230807023528.325191-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: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: B607E180004 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 6wsaoetzfz1s1fbhpm8py5xob9rmz9t9 X-HE-Tag: 1691375752-771791 X-HE-Meta: U2FsdGVkX18q8Wry+dNXIwwcMxWzdqv3siY9kN2kKYfEw08z1IeLFifGFTG3b9bgpuwb9EGbMPxrsnDuushNRWjLZ3UjOuHdoxlqnzzSUDokiFJhaW2Rqq1xAhQEpezA5D8hFu6teJg5RQMehfXNMedERNYwhP/6tqXqqIstGH1oPWCWTQj7qsLpI1ac9rCd6JdStjxQFT7TfRjTVx/UySML0zpBsvwYfWbSd+R62Dgi+OdW4Qgo+MIzKC1wupWXQTG9rRKDUw3PWSuN48Yz1A34huiar/qES1n/e2E5mQjmsSTLHL+i0ihWUIfeB5hV/o8x6zIBsVcBkztkBJd7DUxI7G7nDw6kau8/s5hwCKEYjueKIo+khWHW+bJ3lZO+PMIiUYT4DH7T+ShUDnHMOHr+EdzMvSWgmzAXHOv0G8jEa95YzvFzFvdcPDgH8PUwHtuJsSqYNxlV1XcKZ23xBYVkAC78/LyxbrliShlBMRbvYf+ITuz1olgcqw273hdNAHwTCMMxcpuhGo/ME7H6bTc1nHtfwcssyxTG1HPBPwp1loi+sh/KwPe1pXyPg5qwRkOeTPaETLYpYL7KOTAM1q+Ul4wqGkKCXGZVD6EM9Ib6K//U38Ioil+5oRLSuDaAR/2fb+kFkXEDRuIBMUCftCnvH36xy+9E4LP647QDYIWXgfYKHwOBh9spu+hR+j85P1wVCklS0GLfuOnF+w90xZqUul/8n7yXD7Xe4Xs6QMxux9LeLKJ2BHnEHSDzOidPKWbPQJDUCCq1gVf+qjUAF71T1yFLSoDDW48BTNeaY/BPGsK5XF4LBFsDdZAfoROynUmSGYykzeuiL9EIZOLeCDFDCA2htsyJ9U4X1awWgQs/LQfKYMMxZcR1sm41pU2hCx91p9V7flbCy0VtLeCaqMcYwz16o8PrVvqkfwCKE32aI2CxcIJzzy9eA7SEI6dKsaVdS2WYK67y1XwE8hA eJjIK5br H99GXr+ZLBaQ2c9AveCxkJJPmY86cK2OjsL5EwoxbqrHvJMuxqCdsjzOwdOXGM6qZCV+5NLvMxAkFotHv/WwHNaEdSMsnCagRHPwjG4LX0fOJ2qMwI2U3MXqGlzkVdYuOV4IUexFapDdxkx8wGSu0tY80UgNpSpYnma24P5QGtPHb+qbF7v5EFJHFDMnC0mODkupYSjQuJq7UI2+amkIhFREmQQ== 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 Reviewed-by: David Hildenbrand Reviewed-by: Mike Rapoport (IBM) --- v2: use BITS_PER_BYTE per Mike. Collect Reviewed-by tag per David. Thanks both. --- 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)