Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1330182

Re: [tip:x86/boot] x86/boot: Micro-optimize reset_early_page_tables()

From Ingo Molnar <mingo@kernel.org>
Newsgroups linux.kernel
Subject Re: [tip:x86/boot] x86/boot: Micro-optimize reset_early_page_tables()
Date 2016-02-09 13:30 +0100
Message-ID <r0fAC-3Wc-33@gated-at.bofh.it> (permalink)
References <qWyLv-8gv-5@gated-at.bofh.it> <qWz4S-8oS-3@gated-at.bofh.it> <qYCrE-10Z-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


* Yinghai Lu <yinghai@kernel.org> wrote:

> On Sat, Jan 30, 2016 at 12:26 AM, tip-bot for Alexander Kuleshov
> <tipbot@zytor.com> wrote:
> > ---
> >  arch/x86/kernel/head64.c | 14 +++-----------
> >  1 file changed, 3 insertions(+), 11 deletions(-)
> >
> > diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
> > index f129a9a..35843ca 100644
> > --- a/arch/x86/kernel/head64.c
> > +++ b/arch/x86/kernel/head64.c
> > @@ -40,13 +40,8 @@ pmdval_t early_pmd_flags = __PAGE_KERNEL_LARGE & ~(_PAGE_GLOBAL | _PAGE_NX);
> 
> .
> >
> > @@ -54,7 +49,6 @@ static void __init reset_early_page_tables(void)
> >  int __init early_make_pgtable(unsigned long address)
> >  {
> >         unsigned long physaddr = address - __PAGE_OFFSET;
> > -       unsigned long i;
> >         pgdval_t pgd, *pgd_p;
> >         pudval_t pud, *pud_p;
> >         pmdval_t pmd, *pmd_p;
> > @@ -81,8 +75,7 @@ again:
> >                 }
> >
> >                 pud_p = (pudval_t *)early_dynamic_pgts[next_early_pgt++];
> > -               for (i = 0; i < PTRS_PER_PUD; i++)
> > -                       pud_p[i] = 0;
> > +               memset(pud_p, 0, sizeof(pud_p) * PTRS_PER_PUD);
> 
> should be
>                   memset(pud_p, 0, sizeof(*pud_p) * PTRS_PER_PUD);
> 
> >                 *pgd_p = (pgdval_t)pud_p - __START_KERNEL_map + phys_base + _KERNPG_TABLE;
> >         }
> >         pud_p += pud_index(address);
> > @@ -97,8 +90,7 @@ again:
> >                 }
> >
> >                 pmd_p = (pmdval_t *)early_dynamic_pgts[next_early_pgt++];
> > -               for (i = 0; i < PTRS_PER_PMD; i++)
> > -                       pmd_p[i] = 0;
> > +               memset(pmd_p, 0, sizeof(pmd_p) * PTRS_PER_PMD);
> 
> should be
>                     memset(pmd_p, 0, sizeof(*pmd_p) * PTRS_PER_PMD);

Indeed. Fortunately the two sizes are the same AFAICS, but this should 
nevertheless be fixed.

Thanks,

	Ingo

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] x86/head64: micro optimization: use memset instead of for loop Alexander Kuleshov <kuleshovmail@gmail.com> - 2016-01-30 09:10 +0100
  [tip:x86/boot] x86/boot: Micro-optimize reset_early_page_tables() tip-bot for Alexander Kuleshov <tipbot@zytor.com> - 2016-01-30 09:30 +0100
    Re: [tip:x86/boot] x86/boot: Micro-optimize reset_early_page_tables() Yinghai Lu <yinghai@kernel.org> - 2016-02-05 01:30 +0100
      Re: [tip:x86/boot] x86/boot: Micro-optimize reset_early_page_tables() Ingo Molnar <mingo@kernel.org> - 2016-02-09 13:30 +0100
        [PATCH v2] x86/head64: micro optimization: use memset instead of for loop Alexander Kuleshov <kuleshovmail@gmail.com> - 2016-02-09 14:20 +0100
          Re: [PATCH v2] x86/head64: micro optimization: use memset instead of  for loop Ingo Molnar <mingo@kernel.org> - 2016-02-09 14:20 +0100

csiph-web