From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 372FDC433DB for ; Mon, 1 Feb 2021 10:56:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B769964E3C for ; Mon, 1 Feb 2021 10:56:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B769964E3C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 20FEA6B0073; Mon, 1 Feb 2021 05:56:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1C04B6B0074; Mon, 1 Feb 2021 05:56:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B1176B0075; Mon, 1 Feb 2021 05:56:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0093.hostedemail.com [216.40.44.93]) by kanga.kvack.org (Postfix) with ESMTP id EAE0C6B0073 for ; Mon, 1 Feb 2021 05:56:21 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B75D4180AD817 for ; Mon, 1 Feb 2021 10:56:21 +0000 (UTC) X-FDA: 77769394962.18.BDC4D25 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 03A1C20001E2 for ; Mon, 1 Feb 2021 10:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612176980; h=from:from: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=J3XvAahXJW5cdCbjvCC5eOVYocg/eTTFP3qY+k4MykA=; b=A+SMA5I4TOM3gVx6htX3VrCrtG2Abk/6x5DNuuI8r53lob2khQXpsrSUD9P1Ra4tXkiWRs XtmDkwOpTMFM3j827jTPVXB1UUnygyPi/JZUX9w3oVm8wFJsB8sFn9rXt+day8jcSwVSb5 aVOokEoZyVKVqE0f/hCnjOo5YQylGTU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-354-oIfjoXXZOMSfnyX40v34pA-1; Mon, 01 Feb 2021 05:56:18 -0500 X-MC-Unique: oIfjoXXZOMSfnyX40v34pA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9BE0A1842142; Mon, 1 Feb 2021 10:56:17 +0000 (UTC) Received: from [10.36.115.24] (ovpn-115-24.ams2.redhat.com [10.36.115.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 818565D9DC; Mon, 1 Feb 2021 10:56:16 +0000 (UTC) Subject: Re: [PATCH] hugetlbfs: rework calculation code of Hugepage size in hugetlbfs_show_options() To: Miaohe Lin , akpm@linux-foundation.org, mike.kravetz@oracle.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20210201082325.33875-1-linmiaohe@huawei.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <2bb70cac-b8ef-cdbe-fa4e-db6229587e98@redhat.com> Date: Mon, 1 Feb 2021 11:56:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20210201082325.33875-1-linmiaohe@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Stat-Signature: dewbpkmd8b7m9axe49jfo995c4zunigk X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 03A1C20001E2 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=63.128.21.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1612176979-134165 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: On 01.02.21 09:23, Miaohe Lin wrote: > Rework calculation code of the Hugepage size to make it more readable and > straightforward. > > Signed-off-by: Miaohe Lin > --- > fs/hugetlbfs/inode.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c > index 3a08fbae3b53..1be18de4b537 100644 > --- a/fs/hugetlbfs/inode.c > +++ b/fs/hugetlbfs/inode.c > @@ -1014,11 +1014,12 @@ 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; > - mod = 'K'; > - if (hpage_size >= 1024) { > - hpage_size /= 1024; > + if (hpage_size >= SZ_1M) { > + hpage_size /= SZ_1M; > mod = 'M'; > + } else { > + hpage_size /= SZ_1K; > + mod = 'K'; > } > seq_printf(m, ",pagesize=%lu%c", hpage_size, mod); > if (spool) { > Looks correct but I am not convinced the old code was that complicated to understand. -- Thanks, David / dhildenb