From patchwork Thu Sep 1 12:00:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12962359 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 C5BA3C0502C for ; Thu, 1 Sep 2022 12:01:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A617C8D0006; Thu, 1 Sep 2022 08:01:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A0F2D8D0003; Thu, 1 Sep 2022 08:01:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 839E38D0006; Thu, 1 Sep 2022 08:01:07 -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 73E418D0003 for ; Thu, 1 Sep 2022 08:01:07 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 49D7D16054A for ; Thu, 1 Sep 2022 12:01:07 +0000 (UTC) X-FDA: 79863375774.18.80BC181 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf13.hostedemail.com (Postfix) with ESMTP id 9FF2F2004B for ; Thu, 1 Sep 2022 12:01:06 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJKKt0LyrzlWdW; Thu, 1 Sep 2022 19:57:38 +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:03 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH v2 06/10] hugetlb: pass NULL to kobj_to_hstate() if nid is unused Date: Thu, 1 Sep 2022 20:00:26 +0800 Message-ID: <20220901120030.63318-7-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=1662033666; 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=E5T/LQQVnJzxbj87ZXz9RrpAIPDwSBKqs8GyxnBwM/U=; b=44/kM7WjlxeyebPJxQ5lcWaYhcpjNN4DwlQon7b+W8/fX/s2FoA7OTy64Y0oQXcfvaga7F rYNc+0gttU2HJhchDMY0uWbFNTEHgu3SdCPUfW+mNm3p/sdoazcsVfgdtWBMbOMffblzrm rtgRmlgERaetLzh4Cudo0kxeVBPTb7c= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.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=1662033666; a=rsa-sha256; cv=none; b=0cqinfq0xycp3CvhFvlRD7D0l6NtXCUZoZ/dnY2w8/SerCeCim9gxYoMo3oWFvihDabPKS J4kvE4/9+YtCas89rKWJfExSFPxy9f96dazwrjl2Ohi0GGLL2d7cXCyLnIU9WfEfTfCvj/ CweLUlKhM33XPhLxz4p1wYn+ovyu/fg= Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Queue-Id: 9FF2F2004B X-Stat-Signature: egibg6aefwr5qrmhwzi8q14fzajihs1j X-Rspam-User: X-Rspamd-Server: rspam02 X-HE-Tag: 1662033666-179985 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: 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 d35381de90c3..bb65b7fdca25 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 = kobj_to_hstate(kobj, &nid); + struct hstate *h = kobj_to_hstate(kobj, NULL); unsigned long demote_size = (PAGE_SIZE << h->demote_order) / SZ_1K; 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; demote_size = (unsigned long)memparse(buf, NULL); @@ -3805,7 +3803,7 @@ static ssize_t demote_size_store(struct kobject *kobj, return -EINVAL; /* demote order must be smaller than hstate order */ - h = kobj_to_hstate(kobj, &nid); + h = kobj_to_hstate(kobj, NULL); if (demote_order >= h->order) return -EINVAL;