Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp239634rwn; Wed, 14 Sep 2022 19:57:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR4iCXRoERBtrWkIxW/VLPTS5IqeFILJWp2/EftrEiJm74MCu3cIpmP620GG/MGDJo7bOnyL X-Received: by 2002:a05:6402:2423:b0:446:3b6b:e3ee with SMTP id t35-20020a056402242300b004463b6be3eemr33792191eda.412.1663210639048; Wed, 14 Sep 2022 19:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663210639; cv=none; d=google.com; s=arc-20160816; b=wKCKh8inJI0WYzDDV3T8aL7QSYa6qnHAdZ73FiMyoNVtxHFSVPYCYzG5FGnEPg10km keS0AOALphA/dxxL71fqLLY51lZnekFhH6eq+4b6OX8eNw5TKRG7H+Wy5yZi9YYnAX+z A9WdxuyWhi4GOWfb/xb0yn6af0nNaeA1a3HYfvnXaSN6VrQBieWHVg2A1/RtNYXJF84o a/5oZtDf6oPKevjEFgauRFBiNl7/iI1EbR2KLQG9+OqtJk45KEv4+kmSLky7fPd4DI10 83vJIDE6b3GmB+BJOHoYINdQz4t9FvVHhPVolRtvxigR8mAbAAIM0oCKd8sV5lghV2L8 LflA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=ESRYdkU5ESV2p1cNWSzcaEC0Mn/lkXf9i/HR4EQsYMY=; b=FTH6XIltmUr949VB81KyMq6pkGqXg85DFgFdL2chJJ48YV28Sobz+Ywa1ZFwuncpmC rb7tCkb9AYbPrkeO1v9EZCqw/zD8InKATlei4B2nPiY+f9nyUTpr0/sYsQQ0iAUdcXto rQcqOA69CAOcR5MF1VA8qXzSwI/ysimxdldkj8OV6/QwLho2t+iPE8B6xRfJjecXFJEc SHyNOGxyOvYtLFRH3WI0VfsNySE844wMo9FxUp6LfvaId8+nP5Xas1pKWKLlzLCmB2j1 0rC017dL49G3P1s6qszc5FWtoNVjLZeBG+FIg5lJI4Kx1IVJ0UmD5YwjV4IhO5rRWPE/ RRCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q2-20020a50aa82000000b0044e85e58093si14986929edc.581.2022.09.14.19.56.53; Wed, 14 Sep 2022 19:57:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229554AbiIOCor (ORCPT + 99 others); Wed, 14 Sep 2022 22:44:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbiIOCoo (ORCPT ); Wed, 14 Sep 2022 22:44:44 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6951A1B0 for ; Wed, 14 Sep 2022 19:44:41 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=xhao@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VPqlKcb_1663209877; Received: from 30.240.97.215(mailfrom:xhao@linux.alibaba.com fp:SMTPD_---0VPqlKcb_1663209877) by smtp.aliyun-inc.com; Thu, 15 Sep 2022 10:44:38 +0800 Message-ID: <408fbc89-8711-0ea2-16e7-99b746e1f09e@linux.alibaba.com> Date: Thu, 15 Sep 2022 10:44:37 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH] mm/hugetlbfs: use macro SZ_1K to replace 1024 To: Al Viro Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, mike.kravetz@oracle.com, songmuchun@bytedance.com, SeongJae Park References: <20220914115723.38271-1-xhao@linux.alibaba.com> From: haoxin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2022/9/15 上午12:43, Al Viro 写道: > On Wed, Sep 14, 2022 at 07:57:23PM +0800, Xin Hao wrote: >> Using macro SZ_1K in hugetlbfs_show_options() has no any functional >> changes, just makes code more readable. > Why is it any more readable that way? The main purpose of this code is to convert size to 'K', and 'M'. I think using SZ_1k does look more appropriate than 1024, that's all. >> Signed-off-by: Xin Hao >> --- >> fs/hugetlbfs/inode.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c >> index f7a5b5124d8a..9b9784ffe8de 100644 >> --- a/fs/hugetlbfs/inode.c >> +++ b/fs/hugetlbfs/inode.c >> @@ -1023,10 +1023,10 @@ static int hugetlbfs_show_options(struct seq_file *m, struct dentry *root) >> if (sbinfo->max_inodes != -1) >> seq_printf(m, ",nr_inodes=%lu", sbinfo->max_inodes); >> >> - hpage_size /= 1024; >> + hpage_size /= SZ_1K; >> mod = 'K'; >> - if (hpage_size >= 1024) { >> - hpage_size /= 1024; >> + if (hpage_size >= SZ_1K) { >> + hpage_size /= SZ_1K; >> mod = 'M'; >> } >> seq_printf(m, ",pagesize=%lu%c", hpage_size, mod); >> -- >> 2.31.0