From patchwork Thu Jul 28 12:19:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12931197 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 CD148C04A68 for ; Thu, 28 Jul 2022 12:20:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE6DA6B0075; Thu, 28 Jul 2022 08:20:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F8256B0078; Thu, 28 Jul 2022 08:20:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8BE138E0001; Thu, 28 Jul 2022 08:20:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 7D4206B0075 for ; Thu, 28 Jul 2022 08:20:11 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5237C80F63 for ; Thu, 28 Jul 2022 12:20:11 +0000 (UTC) X-FDA: 79736415822.31.967FD3A Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf10.hostedemail.com (Postfix) with ESMTP id B4659C00AA for ; Thu, 28 Jul 2022 12:20:10 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LtqSb2DTSz9svq; Thu, 28 Jul 2022 20:18:55 +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, 28 Jul 2022 20:20:06 +0800 From: Miaohe Lin To: CC: , , , , Subject: [PATCH 5/6] hugetlb_cgroup: use helper macro NUMA_NO_NODE Date: Thu, 28 Jul 2022 20:19:48 +0800 Message-ID: <20220728121949.20985-6-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220728121949.20985-1-linmiaohe@huawei.com> References: <20220728121949.20985-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659010811; a=rsa-sha256; cv=none; b=c7colyTiiZx/xfxwqJj7hubUvN8w3pOt8TkC2VW1i5eGxPmxjoZIuWh+0QV09B05xP6IpS PUdpyIjAJgg8unRCoqHZvHktrUPRem+fLWSDCPG5JPUCVKbWYVTzoSGEIUNcpGcb+GFZWJ WcRS1BKGPMp5IRhqS7K8KYDZG3lyb+U= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf10.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 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=1659010811; 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=MgyhmvMq7xlcwCXjOdf9or2ojdpUHLN3+s74D0iDNX0=; b=LoPYTclkmkE4n9/XzKTb8cvO+P73oBedr6Cg6QSlkmVwDHh8VY/pRmZi2ixF53U7pCkzn1 MMZUjf4YHZUpBsYv6csJ6O3ZIxG+FpgLTp1k8tokFsRnXDb2dCUUdgRZNX0+6Ve/abw9vF B4ymA3BVG8bSXbo84GUsUtIfxbxES7s= X-Rspamd-Queue-Id: B4659C00AA X-Rspam-User: X-Stat-Signature: aka5uhq8ppinqegf1se4eu94mmjr5kx4 Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf10.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Server: rspam08 X-HE-Tag: 1659010810-442466 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 NUMA_NO_NODE instead of magic number -1. Minor readability improvement. Signed-off-by: Miaohe Lin Reviewed-by: Mina Almasry --- mm/hugetlb_cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index 7e0bca52c40f..13ec091385af 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -153,9 +153,9 @@ hugetlb_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) * function. */ for_each_node(node) { - /* Set node_to_alloc to -1 for offline nodes. */ + /* Set node_to_alloc to NUMA_NO_NODE for offline nodes. */ int node_to_alloc = - node_state(node, N_NORMAL_MEMORY) ? node : -1; + node_state(node, N_NORMAL_MEMORY) ? node : NUMA_NO_NODE; h_cgroup->nodeinfo[node] = kzalloc_node(sizeof(struct hugetlb_cgroup_per_node), GFP_KERNEL, node_to_alloc);