From patchwork Thu Jul 21 13:16:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12925104 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 E6BCAC43334 for ; Thu, 21 Jul 2022 13:16:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6A3E68E0006; Thu, 21 Jul 2022 09:16:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 68CE68E000A; Thu, 21 Jul 2022 09:16:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52CB98E0006; Thu, 21 Jul 2022 09:16:54 -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 466288E0001 for ; Thu, 21 Jul 2022 09:16:54 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 177B1140904 for ; Thu, 21 Jul 2022 13:16:54 +0000 (UTC) X-FDA: 79711157148.19.7DE8443 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf19.hostedemail.com (Postfix) with ESMTP id 0FD8C1A0020 for ; Thu, 21 Jul 2022 13:16:52 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LpY3P5bhQzGpB1; Thu, 21 Jul 2022 21:15:45 +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, 21 Jul 2022 21:16:49 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH 1/5] hugetlbfs: use helper macro SZ_1{K,M} Date: Thu, 21 Jul 2022 21:16:33 +0800 Message-ID: <20220721131637.6306-2-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220721131637.6306-1-linmiaohe@huawei.com> References: <20220721131637.6306-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-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf19.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658409413; a=rsa-sha256; cv=none; b=zgk2HukT5KwPGXrhvUI9RCO8emTJZ8cC2Bvg2grZXC79kjCuQJ9WHG19s53GVog1WLBzDL 9faQzkosOIc48pE+QOB0Nvk4Sra1en/Fawenc+EP1Sg/dwcmSHr2uDcd3SRLiuPg5WPuJP ggFynTQ4ej2CV0AQiXoi55WmAJu6/ec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658409413; 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=kn70LfoaoQVCS1gdGpO3t59LOsjCh4HKNqCKQRHWEN4=; b=RuGSOy5HNpzfPOCxc6twZhaqjJsc++/Qr7087+yaV9qeIijcv14nvnWo0Wo8SN+5AZU/Ad dFl+PrHt8S2Q2Urd6ANl8u1Z2q0wtL2yKdIzO13phgDG2h5kzz/HUQELpEMXd+SxKvj+CP 0G3GHUNLLXs5KSMepmnQwFH9QZw2aCA= Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf19.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspam-User: X-Rspamd-Server: rspam01 X-Stat-Signature: rh9qm15g1wozn3mmdghzomfjpm1rs1or X-Rspamd-Queue-Id: 0FD8C1A0020 X-HE-Tag: 1658409412-172701 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: Use helper macro SZ_1K and SZ_1M to do the size conversion. Minor readability improvement. Signed-off-by: Miaohe Lin Reviewed-by: Mike Kravetz --- fs/hugetlbfs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 20336cb3c040..e998c416b85f 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1309,7 +1309,7 @@ static int hugetlbfs_parse_param(struct fs_context *fc, struct fs_parameter *par ps = memparse(param->string, &rest); ctx->hstate = size_to_hstate(ps); if (!ctx->hstate) { - pr_err("Unsupported page size %lu MB\n", ps >> 20); + pr_err("Unsupported page size %lu MB\n", ps / SZ_1M); return -EINVAL; } return 0; @@ -1555,7 +1555,7 @@ static struct vfsmount *__init mount_one_hugetlbfs(struct hstate *h) } if (IS_ERR(mnt)) pr_err("Cannot mount internal hugetlbfs for page size %luK", - huge_page_size(h) >> 10); + huge_page_size(h) / SZ_1K); return mnt; }