Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2774306pxb; Sat, 30 Jan 2021 14:14:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxscRuhgqkbDe+IMBRrcEDEpp3rH1qiEe5X8BHuJkBE5OLjpB00tNrgOJPYmvFENZBPkPIl X-Received: by 2002:a17:906:998e:: with SMTP id af14mr2698285ejc.445.1612044876795; Sat, 30 Jan 2021 14:14:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612044876; cv=none; d=google.com; s=arc-20160816; b=0IKSt3GgpYSjLJSZoWqWNjMcS1ONgZNkg3te67PsiKEw7kvuX/lrWg7LuzpKoG+cCe cSnCq/fHFMADtO0TUZUIgJ40xYGPRL1kcfdT98vDmT/UizP2CWQzWOM+I7KlIF78PBNE FoZMzG//fhjS/T02hm5TTTa2r+3W+Z2KXeE1pM4Zexr8Fgm5l97TyNHgXUqjxwThrMJq URcH5Gpe1CssxFeZJBB7SSwqxH8tB1eu7TPBz8YqHXTPiuwqLR7tyU2ErNufXXC3hAez pGOGn8nzlL7gpn+uqb3ElPERsVnd6sUlFJ9WRqAaRjtdW5khyqcqvE6LbFqOy4qCt8AV /7vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=/P/b4VQw8CInKf0Exrq1ninzQwAk3br3MdPWZqjCM5w=; b=g9YQZ8pxEKF0ua6FlCPlE4e7PzaDr256OdaPHgtynl9IclzqdzQQFoYblyUQFSkvq+ LLAjrvaXZeZWtEqLeJ89ZUhr61MCQ1SRl1bG8Qx7Pw6C/U2Nq1L7sjCP0Hkc7ts+cO2N yu9In426gRasJSw6lO5GsLLLak0TTs2MUu1NXS7OTsFh3omCQfmfkCmh4Jp3cwozdMFI 448jQ1jTDYs+BcP8Dw3rWlunuUaniTB0iuyJWONvvsbPpQmlJ7d3VXQ08GioIsmwTuOG QqwShXxMEhdVCOfjsE5eUISjpFB9gQrHQkDSgJUYpVMP6zSXdZ2R4YhT6wQYP2nTjunz Qp6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RnuxL8Th; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x20si8221133eds.7.2021.01.30.14.13.39; Sat, 30 Jan 2021 14:14:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RnuxL8Th; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231690AbhA3WIP (ORCPT + 99 others); Sat, 30 Jan 2021 17:08:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230168AbhA3WIN (ORCPT ); Sat, 30 Jan 2021 17:08:13 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E75C061573 for ; Sat, 30 Jan 2021 14:07:33 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id s15so7824230plr.9 for ; Sat, 30 Jan 2021 14:07:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=/P/b4VQw8CInKf0Exrq1ninzQwAk3br3MdPWZqjCM5w=; b=RnuxL8ThemW1uGFiJS+C2acS9C2US8HUzkp5RgN0kj9o1dwU0VOBcuKG6XOtZssWLQ I3RQ7n3hildS5pk9uJaw188Ax4uVQNBeA8cN7tDqnZUpSmxvM7CwSBF4gHnCXdSvKOFc t+KTIlRo1kTmTIWzbXPph6cQVhQTNtyVtbLmvVi9QVIzzDG+RfDVpGRLjnxerJIByljY GUSp20jDiFJNRUVhpibuvr1hc8VY97QRsVChOp0WFifjy4m1Y5gfDsGkVGM3g/ezfmM3 dSgBjkLJdPbem0ZO+HR1WpA8thVwubtjK0L0ppbyzgLhkYbF5WYkycJ4pj+4oWIJO4F5 et3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=/P/b4VQw8CInKf0Exrq1ninzQwAk3br3MdPWZqjCM5w=; b=eR3dIIaZcCT09O2adYLCnwb44AQ1p7ocM+iVTXPfF3PzuFruUv8QXkGrhth8/G17Xn lzJxBdxZ//LjznYuxGcCJv+SlJvP9VNIh8JujHDmNYxTFpfQV4X0f/hoVMtcjkgnLXe+ Pqj1D0z06qfXOdPcYCPRrt9pBVgtF86k1BigVkbuvO8HGCdL6Bc2vtNErmUHMbKr8wMk aEUxwY9AVZTu/yClP+CJN+wQP0BBEqXDfJcJOJL5mGjNpUFDVzQTOP0SP8NFv9B2HWmT B/pWqln5y4wRlll41MB4XdwcwK8fhBmH04q4XXdN3pgnxy31Uff10nvOVBbf96N87x7i p+lA== X-Gm-Message-State: AOAM532irNGzTtgwPUT5PTY13fL3AAWHZQu2ysaIs9PoW1YmX+7K5+Ds STrqGyHdLyRdE9uxRhFMGN5iUtcm2JsASg== X-Received: by 2002:a17:90a:9905:: with SMTP id b5mr10339808pjp.195.1612044452393; Sat, 30 Jan 2021 14:07:32 -0800 (PST) Received: from [2620:15c:17:3:4a0f:cfff:fe51:6667] ([2620:15c:17:3:4a0f:cfff:fe51:6667]) by smtp.gmail.com with ESMTPSA id b14sm12004292pju.14.2021.01.30.14.07.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Jan 2021 14:07:31 -0800 (PST) Date: Sat, 30 Jan 2021 14:07:30 -0800 (PST) From: David Rientjes To: Miaohe Lin cc: akpm@linux-foundation.org, mike.kravetz@oracle.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] hugetlbfs: show pagesize in unit of GB if possible In-Reply-To: <20210130090339.4378-1-linmiaohe@huawei.com> Message-ID: References: <20210130090339.4378-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 30 Jan 2021, Miaohe Lin wrote: > Hugepage size in unit of GB is supported. We could show pagesize in unit of > GB to make it more friendly to read. Also rework the calculation code of > page size unit to make it more readable. > > Signed-off-by: Miaohe Lin > --- > fs/hugetlbfs/inode.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c > index 3a08fbae3b53..40a9795f250a 100644 > --- a/fs/hugetlbfs/inode.c > +++ b/fs/hugetlbfs/inode.c > @@ -1014,11 +1014,15 @@ 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_1G) { > + hpage_size /= SZ_1G; > + mod = 'G'; > + } else 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) { NACK, this can break existing userspace parsing.