linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'haoxin' <xhao@linux.alibaba.com>, Al Viro <viro@zeniv.linux.org.uk>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"mike.kravetz@oracle.com" <mike.kravetz@oracle.com>,
	"songmuchun@bytedance.com" <songmuchun@bytedance.com>,
	SeongJae Park <sj@kernel.org>
Subject: RE: [PATCH] mm/hugetlbfs: use macro SZ_1K to replace 1024
Date: Fri, 16 Sep 2022 11:47:42 +0000	[thread overview]
Message-ID: <6fe4a3c252a34199b715e4e941fb2be7@AcuMS.aculab.com> (raw)
In-Reply-To: <408fbc89-8711-0ea2-16e7-99b746e1f09e@linux.alibaba.com>

From: haoxin
> Sent: 15 September 2022 03:45
> 
> 在 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.

You'd need to use SZ_1M/SZ_1K if you want to be descriptive.
But really it just uses up more brain cycles to read.

Using named constants for things that are absolutely constant
isn't really necessary.

If you have '#define ONE 1' are you ever going to set it to
a different value?

And don't even think about what happens to systems that had
small integer constants at 'well known' addresses and then
managed to change one of them.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

      reply	other threads:[~2022-09-16 11:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 11:57 Xin Hao
2022-09-14 14:03 ` SeongJae Park
2022-09-14 16:43 ` Al Viro
2022-09-15  2:44   ` haoxin
2022-09-16 11:47     ` David Laight [this message]

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=6fe4a3c252a34199b715e4e941fb2be7@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=sj@kernel.org \
    --cc=songmuchun@bytedance.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xhao@linux.alibaba.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