linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mina Almasry <almasrymina@google.com>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: akpm@linux-foundation.org, mike.kravetz@oracle.com,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/6] hugetlb_cgroup: hugetlbfs: use helper macro SZ_1{K,M,G}
Date: Thu, 28 Jul 2022 10:48:41 -0700	[thread overview]
Message-ID: <CAHS8izMiKaZb+D_ZW2UasUThnCTUarE3kObz8BESBGD8XgfNoA@mail.gmail.com> (raw)
In-Reply-To: <20220728121949.20985-4-linmiaohe@huawei.com>

On Thu, Jul 28, 2022 at 5:20 AM Miaohe Lin <linmiaohe@huawei.com> wrote:
>
> Use helper macro SZ_1K, SZ_1M and SZ_1G to do the size conversion. Minor
> readability improvement.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Thanks Miaohe,

Reviewed-by: Mina Almasry <almasrymina@google.com>

> ---
>  mm/hugetlb_cgroup.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
> index 99e9a367e1e5..7e0bca52c40f 100644
> --- a/mm/hugetlb_cgroup.c
> +++ b/mm/hugetlb_cgroup.c
> @@ -674,12 +674,12 @@ static ssize_t hugetlb_cgroup_reset(struct kernfs_open_file *of,
>
>  static char *mem_fmt(char *buf, int size, unsigned long hsize)
>  {
> -       if (hsize >= (1UL << 30))
> -               snprintf(buf, size, "%luGB", hsize >> 30);
> -       else if (hsize >= (1UL << 20))
> -               snprintf(buf, size, "%luMB", hsize >> 20);
> +       if (hsize >= SZ_1G)
> +               snprintf(buf, size, "%luGB", hsize / SZ_1G);
> +       else if (hsize >= SZ_1M)
> +               snprintf(buf, size, "%luMB", hsize / SZ_1M);
>         else
> -               snprintf(buf, size, "%luKB", hsize >> 10);
> +               snprintf(buf, size, "%luKB", hsize / SZ_1K);
>         return buf;
>  }
>
> --
> 2.23.0
>


  reply	other threads:[~2022-07-28 17:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 12:19 [PATCH 0/6] A few cleanup patches for hugetlb_cgroup Miaohe Lin
2022-07-28 12:19 ` [PATCH 1/6] hugetlb_cgroup: remove unneeded nr_pages > 0 check Miaohe Lin
2022-07-28 17:44   ` Mina Almasry
2022-07-28 12:19 ` [PATCH 2/6] hugetlb_cgroup: remove unneeded header file Miaohe Lin
2022-07-28 17:45   ` Mina Almasry
2022-07-28 18:02     ` Mina Almasry
2022-07-29  1:07       ` Miaohe Lin
2022-07-28 12:19 ` [PATCH 3/6] hugetlb_cgroup: hugetlbfs: use helper macro SZ_1{K,M,G} Miaohe Lin
2022-07-28 17:48   ` Mina Almasry [this message]
2022-07-28 12:19 ` [PATCH 4/6] hugetlb_cgroup: remove unneeded return value Miaohe Lin
2022-07-28 22:35   ` Mike Kravetz
2022-07-28 12:19 ` [PATCH 5/6] hugetlb_cgroup: use helper macro NUMA_NO_NODE Miaohe Lin
2022-07-28 18:00   ` Mina Almasry
2022-07-28 12:19 ` [PATCH 6/6] hugetlb_cgroup: use helper for_each_hstate and hstate_index Miaohe Lin
2022-07-28 18:04   ` Mina Almasry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHS8izMiKaZb+D_ZW2UasUThnCTUarE3kObz8BESBGD8XgfNoA@mail.gmail.com \
    --to=almasrymina@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox