linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	the arch/x86 maintainers <x86@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Thomas Garnier <thgarnie@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Yasuaki Ishimatsu <yasu.isimatu@gmail.com>,
	Jinbum Park <jinb.park7@gmail.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Dave Young <dyoung@redhat.com>
Subject: Re: [PATCH] x86/mm: Fix incorrect for loop count calculation in sync_global_pgds
Date: Tue, 2 May 2017 15:18:37 +0800	[thread overview]
Message-ID: <20170502071837.GA2579@x1> (raw)
In-Reply-To: <CAE9FiQXWCydwTKEwm2naxq21o1ODh0jEO3m0FmtNZsLT=TbwSA@mail.gmail.com>

On 05/01/17 at 03:37pm, Yinghai Lu wrote:
> On Mon, May 1, 2017 at 4:41 AM, Baoquan He <bhe@redhat.com> wrote:
> >  arch/x86/mm/init_64.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> > index 15173d3..dbf4f00 100644
> > --- a/arch/x86/mm/init_64.c
> > +++ b/arch/x86/mm/init_64.c
> > @@ -94,12 +94,14 @@ __setup("noexec32=", nonx32_setup);
> >   */
> >  void sync_global_pgds(unsigned long start, unsigned long end)
> >  {
> > -       unsigned long address;
> > +       unsigned long address, address_next;
> >
> > -       for (address = start; address <= end; address += PGDIR_SIZE) {
> > +       for (address = start; address <= end; address = address_next) {
> >                 const pgd_t *pgd_ref = pgd_offset_k(address);
> >                 struct page *page;
> >
> > +               address_next = (address & PGDIR_MASK) + PGDIR_SIZE;
> > +
> >                 if (pgd_none(*pgd_ref))
> >                         continue;
> >
> 
> This one is better than V2.
> 
> It would better if could rename address to addr as Ingo suggested.

Thanks for your checking and suggestion, Yinghai.

Both v1 and v2 are fine to me. As you said, code in v1 is easily
understood, while v2 code is more compact, less line. The line of v1 is
not more than 80. Maybe Ingo can help choose one which he likes better.

Thanks
Baoquan

  reply	other threads:[~2017-05-02  7:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-01 11:41 [PATCH] x86/mm: Fix incorrect for loop count calculation in sync_global_pgds Baoquan He
2017-05-01 14:15 ` Thomas Garnier
2017-05-01 14:40 ` Dan Williams
2017-05-01 14:52   ` Baoquan He
2017-05-01 15:24     ` Dan Williams
2017-05-01 15:31       ` Baoquan He
2017-05-01 22:37 ` Yinghai Lu
2017-05-02  7:18   ` Baoquan He [this message]
2017-05-02  7:24     ` Ingo Molnar
2017-05-02  7:40       ` Baoquan He

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=20170502071837.GA2579@x1 \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dyoung@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jinb.park7@gmail.com \
    --cc=keescook@chromium.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=thgarnie@google.com \
    --cc=x86@kernel.org \
    --cc=yasu.isimatu@gmail.com \
    --cc=yinghai@kernel.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;
as well as URLs for NNTP newsgroup(s).