From: Christoph Hellwig <hch@infradead.org>
To: Guo Ren <guoren@kernel.org>
Cc: linux-arch@vger.kernel.org, aou@eecs.berkeley.edu,
palmer@sifive.com, linux-kernel@vger.kernel.org,
Mao Han <mao_han@c-sky.com>,
Christoph Hellwig <hch@infradead.org>,
Guo Ren <ren_guo@c-sky.com>,
linux-riscv@lists.infradead.org
Subject: Re: [PATCH] riscv: fixup max_low_pfn with PFN_DOWN.
Date: Tue, 15 Jan 2019 08:12:54 -0800 [thread overview]
Message-ID: <20190115161254.GA19081@infradead.org> (raw)
In-Reply-To: <20190115161000.GA22705@guoren-Inspiron-7460>
On Wed, Jan 16, 2019 at 12:10:00AM +0800, Guo Ren wrote:
> > > set_max_mapnr(PFN_DOWN(mem_size));
> > > - max_low_pfn = memblock_end_of_DRAM();
> > > + max_low_pfn = PFN_DOWN(memblock_end_of_DRAM());
> >
> > I know it is used just above, but can we please just switch this
> > code to use >> PAGE_SHIFT instead of PFN_DOWN, which just horribly
> > obsfucates what is going on?
> ???
> #define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
>
> phys_addr_t __init_memblock memblock_end_of_DRAM(void)
> {
> int idx = memblock.memory.cnt - 1;
>
> return (memblock.memory.regions[idx].base + memblock.memory.regions[idx].size);
> }
>
> What's the problem? PFN_DOWN() couldn't be used with function call?
PFN_DOWN gives you the correct result. But I think it actually
drastically reduces readability over just opencoding it.
> My patch just want to point out that max_low_pfn is PFN not size. In fact
> there is no error for running without my patch :P
No, I think your patch is correct. I just wonder if we could make
the code easier to read.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2019-01-15 16:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-12 8:16 [PATCH] riscv: fixup max_low_pfn with PFN_DOWN guoren
2019-01-15 15:36 ` Christoph Hellwig
2019-01-15 16:10 ` Guo Ren
2019-01-15 16:12 ` Christoph Hellwig [this message]
2019-01-16 1:07 ` Guo Ren
2019-01-24 2:00 ` Palmer Dabbelt
2019-01-24 2:31 ` Guo Ren
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=20190115161254.GA19081@infradead.org \
--to=hch@infradead.org \
--cc=aou@eecs.berkeley.edu \
--cc=guoren@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mao_han@c-sky.com \
--cc=palmer@sifive.com \
--cc=ren_guo@c-sky.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;
as well as URLs for NNTP newsgroup(s).