From patchwork Fri Aug 26 09:24:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12955707 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 6DE28ECAAD2 for ; Fri, 26 Aug 2022 09:24:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B38FF6B0074; Fri, 26 Aug 2022 05:24:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A249D6B007B; Fri, 26 Aug 2022 05:24:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9157C940007; Fri, 26 Aug 2022 05:24:56 -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 66C8D6B0074 for ; Fri, 26 Aug 2022 05:24:56 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 407B5C02D5 for ; Fri, 26 Aug 2022 09:24:56 +0000 (UTC) X-FDA: 79841209392.28.B0D58F6 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf07.hostedemail.com (Postfix) with ESMTP id A538640012 for ; Fri, 26 Aug 2022 09:24:55 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MDZ8J2VvBzkWj0; Fri, 26 Aug 2022 17:21:20 +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; Fri, 26 Aug 2022 17:24:52 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH 04/10] hugetlb: Use sizeof() to get the array size Date: Fri, 26 Aug 2022 17:24:16 +0800 Message-ID: <20220826092422.39591-5-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220826092422.39591-1-linmiaohe@huawei.com> References: <20220826092422.39591-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf07.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661505895; a=rsa-sha256; cv=none; b=RrUyuHCj9KDhgdUIz6Ci7mb/xq+dVXOI+5NTmbwL4gNp2BeVVW1RYJ5iLbxWAf07R2TSaQ oEoAu6/PfIrU6lTAb9khGDQu1B1015hjDAnnSwpIB63bDKoy17pymkx4wrb3yHHkoP6KLe EQN3kDPKP5QsOOmEoflRJTxAFCIFHSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661505895; 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=kd7TPK0HU0ONq4CeM378iX7C7BW7JTy+h0iF3zRN5yQ=; b=xEziSYdIyQz/CJjG0y9puRDz/N+/pzPwwr08bQh5yX85d3XLRMt5zk8Uu4LJMfbe/q6WLq 3rvpZU49IqwxElP3lMK6C47sU8riGqSVvX0muUF2M2MdKOKCSQxvG2GjSH0swc9vl4dCo4 LICPd5I6x//Ipr5/B/YhZqWWVAUHc6g= X-Stat-Signature: on1y5myn57fba59nbea89hs3rw3zc136 Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf07.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: A538640012 X-Rspam-User: X-HE-Tag: 1661505895-685359 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 b3e6592247a3..06293da96112 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)); } }