From patchwork Fri Aug 26 09:24:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12955711 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 861A1ECAAA3 for ; Fri, 26 Aug 2022 09:25:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F93F6B007E; Fri, 26 Aug 2022 05:24:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6EE1A940007; Fri, 26 Aug 2022 05:24:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F32E6B0082; Fri, 26 Aug 2022 05:24:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 272676B007E for ; Fri, 26 Aug 2022 05:24:57 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 101B81A0226 for ; Fri, 26 Aug 2022 09:24:57 +0000 (UTC) X-FDA: 79841209434.17.2A94D35 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf23.hostedemail.com (Postfix) with ESMTP id 83670140029 for ; Fri, 26 Aug 2022 09:24:56 +0000 (UTC) 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 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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661505896; a=rsa-sha256; cv=none; b=qz9Rdjm/3SNHuILLV4Q2uITM289E/XxunLaAqRg9c/ic5HaCuEGPPbaPXsa77cIPfGzH+C Rqm87wgczV+X84F0BnkDZi5LPj2SFYbbxObfhtv4+ItsUXt4diFa4rPosN0gVy5k0BG341 Fz3soI1NebKfSEaP0i2/8nuSAyvZ92Y= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; spf=pass (imf23.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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661505896; 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=knH/tRTfSRspIeQ8YGY2vcZirI8R+GDqYyoFf5+Z+J0=; b=gQDnGmk0+LzMRElre1Tnw0lPSWavmyxlNRbXIyLh/VoE609NHuNul4UUJYrjO/edsi8I7b TXfF9RRM/m7ovGaQGrHlHJiqXygpFNQFQUT4WXNMw9d1sLkBxhFyFnvgcclEHoigwUE5Eu KotrA+nCMujLg2xnZkdpYEN0PjPPoAc= X-Stat-Signature: kqkd5jfyatypkwi379r3i41kmxsseafx X-Rspamd-Queue-Id: 83670140029 X-Rspam-User: X-Rspamd-Server: rspam06 Authentication-Results: imf23.hostedemail.com; dkim=none; spf=pass (imf23.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-HE-Tag: 1661505896-799170 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 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 = 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;