public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	akpm@linux-foundation.org
Subject: Re: [PATCH v2] x86/mm/64: Rename the register_page_bootmem_memmap() 'size' parameter to 'nr_pages'
Date: Thu, 26 Oct 2017 14:43:01 +0800	[thread overview]
Message-ID: <20171026064301.GA2275@x1> (raw)
In-Reply-To: <20171026062556.2zlzjokxt5jfbql3@gmail.com>

On 10/26/17 at 08:25am, Ingo Molnar wrote:
> 
> * Baoquan He <bhe@redhat.com> wrote:
> 
> > register_page_bootmem_memmap()'s 3rd 'size' parameter is named
> > in a somewhat misleading fashion - rename it to 'nr_pages' which
> > makes the units of it much clearer.
> > 
> > And also rename the existing local variable 'nr_pages' to 'pages'.
> > Otherwise building error will be reported since these two variables
> > are different type though both represent number of pages. Take
> > 'nr_pages' as register_page_bootmem_memmap()'s parameter name since
> > it has more specific meaning, can make better function interface.
> > 
> > Signed-off-by: Baoquan He <bhe@redhat.com>
> > Cc: Linus Torvalds <torvalds@linux-foundation.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: akpm@linux-foundation.org
> > Link: http://lkml.kernel.org/r/1508849249-18035-1-git-send-email-bhe@redhat.com
> > Signed-off-by: Ingo Molnar <mingo@kernel.org>
> > ---
> > v1->v2:
> >   Code change in v1 is incomplete, caused build failure. Change
> >   it after Ingo pointed it out.
> > 
> >   And Ingo helped rewrite the change log of v1. I also add description
> >   about the local variable change. 
> > 
> >  arch/x86/mm/init_64.c | 10 +++++-----
> >  include/linux/mm.h    |  2 +-
> >  2 files changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> > index 048fbe8fc274..18b9d2c7f5ef 100644
> > --- a/arch/x86/mm/init_64.c
> > +++ b/arch/x86/mm/init_64.c
> > @@ -1426,16 +1426,16 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
> >  
> >  #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE)
> >  void register_page_bootmem_memmap(unsigned long section_nr,
> > -				  struct page *start_page, unsigned long size)
> > +				  struct page *start_page, unsigned long nr_pages)
> >  {
> >  	unsigned long addr = (unsigned long)start_page;
> > -	unsigned long end = (unsigned long)(start_page + size);
> > +	unsigned long end = (unsigned long)(start_page + nr_pages);
> >  	unsigned long next;
> >  	pgd_t *pgd;
> >  	p4d_t *p4d;
> >  	pud_t *pud;
> >  	pmd_t *pmd;
> > -	unsigned int nr_pages;
> > +	unsigned int pages;
> >  	struct page *page;
> >  
> >  	for (; addr < end; addr = next) {
> > @@ -1482,9 +1482,9 @@ void register_page_bootmem_memmap(unsigned long section_nr,
> >  			if (pmd_none(*pmd))
> >  				continue;
> >  
> > -			nr_pages = 1 << (get_order(PMD_SIZE));
> > +			pages = 1 << (get_order(PMD_SIZE));
> 
> Why is the get_order() call in extra parentheses?

Yeah, the extra parentheses makes no sense,  will clean it up.

> 
> Also, the 'pages' name sucks in a similar way 'size' sucks - in this context where 
> we _already_ have a nr_pages variable it should be something more expressive like 
> 'nr_pmd_pages' or so.

nr_pmd_pages looks better, will use it instead.

Thanks for reviewing and great suggestion!

Thanks
Baoquan

      reply	other threads:[~2017-10-26  6:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24 14:57 [PATCH v2] x86/mm/64: Rename the register_page_bootmem_memmap() 'size' parameter to 'nr_pages' Baoquan He
2017-10-26  6:25 ` Ingo Molnar
2017-10-26  6:43   ` Baoquan He [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=20171026064301.GA2275@x1 \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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