From nobody Tue Apr 7 16:36:38 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C392CECAAD2 for ; Fri, 26 Aug 2022 09:25:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343700AbiHZJZS (ORCPT ); Fri, 26 Aug 2022 05:25:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343668AbiHZJY5 (ORCPT ); Fri, 26 Aug 2022 05:24:57 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB34F67452 for ; Fri, 26 Aug 2022 02:24:55 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MDZ8K1yqnzkWh6; Fri, 26 Aug 2022 17:21:21 +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:53 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH 06/10] hugetlb: pass NULL to kobj_to_hstate() if nid is unused Date: Fri, 26 Aug 2022 17:24:18 +0800 Message-ID: <20220826092422.39591-7-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 Content-Transfer-Encoding: quoted-printable 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" We can pass NULL to kobj_to_hstate() directly when nid is unused to simplify the code. No functional change intended. Signed-off-by: Miaohe Lin Reviewed-by: Muchun Song --- mm/hugetlb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 6ea9f73aea84..58eeae934e09 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3779,8 +3779,7 @@ HSTATE_ATTR_WO(demote); static ssize_t demote_size_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - int nid; - struct hstate *h =3D kobj_to_hstate(kobj, &nid); + struct hstate *h =3D kobj_to_hstate(kobj, NULL); unsigned long demote_size =3D (PAGE_SIZE << h->demote_order) / SZ_1K; =20 return sysfs_emit(buf, "%lukB\n", demote_size); @@ -3793,7 +3792,6 @@ static ssize_t demote_size_store(struct kobject *kobj, struct hstate *h, *demote_hstate; unsigned long demote_size; unsigned int demote_order; - int nid; =20 demote_size =3D (unsigned long)memparse(buf, NULL); =20 @@ -3805,7 +3803,7 @@ static ssize_t demote_size_store(struct kobject *kobj, return -EINVAL; =20 /* demote order must be smaller than hstate order */ - h =3D kobj_to_hstate(kobj, &nid); + h =3D kobj_to_hstate(kobj, NULL); if (demote_order >=3D h->order) return -EINVAL; =20 --=20 2.23.0