From patchwork Thu Sep 1 12:00:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12962358 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 78435ECAAD1 for ; Thu, 1 Sep 2022 12:01:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 669DE8D0007; Thu, 1 Sep 2022 08:01:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 52D798D0003; Thu, 1 Sep 2022 08:01:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3CE1F8D0007; Thu, 1 Sep 2022 08:01:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 210298D0003 for ; Thu, 1 Sep 2022 08:01:08 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id DFB6C40F1A for ; Thu, 1 Sep 2022 12:01:07 +0000 (UTC) X-FDA: 79863375774.15.A042DC2 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf05.hostedemail.com (Postfix) with ESMTP id EE5D8100037 for ; Thu, 1 Sep 2022 12:01:06 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MJKKZ2hZwzkWV1; Thu, 1 Sep 2022 19:57:22 +0800 (CST) Received: from huawei.com (10.175.124.27) 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.2375.24; Thu, 1 Sep 2022 20:01:02 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH v2 04/10] hugetlb: Use sizeof() to get the array size Date: Thu, 1 Sep 2022 20:00:24 +0800 Message-ID: <20220901120030.63318-5-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220901120030.63318-1-linmiaohe@huawei.com> References: <20220901120030.63318-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662033667; 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:in-reply-to:references:references; bh=ow/14YyLfK/pFXE2D0ITb1fAoA0tErEQlcn5xqZRT2M=; b=5/8G+MqEJKXtjQeQgpILLiHXSXejt7AAIAbN74cBrm5OfD4pUZKsXEyOIWGO4qiz504Pm3 Z0Xg5SQdgbRIMeiczPkbKxX6gjw1h+QCz5jEUW/TfpYN+H0P6x5IQqApwxESTL5MpJqF3q nx7EgS4F0r9M3F8NdV70O5Pc7V+rKD0= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 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=1662033667; a=rsa-sha256; cv=none; b=qz+CrPbewZuWZCCXlAER8xL35NNBurNaLLbCEtw520fdGUt982uDUug3poYyRPtvthmCUh lHRsTzWaHERZ0MZxRnfSMte9z58PCy96XYvGDko8+Y0B/9K3XJvMHo4hiTWpiV2CRtn5Zc LVYgA1Jt4UHjPplNGP/+YmAO/gC+r1A= Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Stat-Signature: 5qcdwtu75dxcwuajrsfdsh63twgdmo19 X-Rspamd-Queue-Id: EE5D8100037 X-Rspamd-Server: rspam05 X-HE-Tag: 1662033666-652586 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 better to use sizeof() to get the array size instead of manual calculation. Minor readability improvement. Signed-off-by: Miaohe Lin Reviewed-by: Muchun Song --- mm/hugetlb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 94cb81e9b4df..c29b444a5515 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4177,11 +4177,11 @@ static void __init hugepages_clear_pages_in_node(void) if (!hugetlb_max_hstate) { default_hstate_max_huge_pages = 0; memset(default_hugepages_in_node, 0, - MAX_NUMNODES * sizeof(unsigned int)); + sizeof(default_hugepages_in_node)); } else { parsed_hstate->max_huge_pages = 0; memset(parsed_hstate->max_huge_pages_node, 0, - MAX_NUMNODES * sizeof(unsigned int)); + sizeof(parsed_hstate->max_huge_pages_node)); } }