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


Groups > linux.kernel > #1713697 > unrolled thread

Re: [PATCHv4 08/14] x86/mm: Make PGDIR_SHIFT and PTRS_PER_P4D variable

Started byIngo Molnar <mingo@kernel.org>
First post2017-08-17 11:10 +0200
Last post2017-08-21 17:30 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCHv4 08/14] x86/mm: Make PGDIR_SHIFT and PTRS_PER_P4D  variable Ingo Molnar <mingo@kernel.org> - 2017-08-17 11:10 +0200
    Re: [PATCHv4 08/14] x86/mm: Make PGDIR_SHIFT and PTRS_PER_P4D  variable "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-08-17 13:00 +0200
      Re: [PATCHv4 08/14] x86/mm: Make PGDIR_SHIFT and PTRS_PER_P4D  variable Ingo Molnar <mingo@kernel.org> - 2017-08-17 13:20 +0200
        Re: [PATCHv4 08/14] x86/mm: Make PGDIR_SHIFT and PTRS_PER_P4D  variable "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-08-21 17:30 +0200

#1713697 — Re: [PATCHv4 08/14] x86/mm: Make PGDIR_SHIFT and PTRS_PER_P4D variable

FromIngo Molnar <mingo@kernel.org>
Date2017-08-17 11:10 +0200
SubjectRe: [PATCHv4 08/14] x86/mm: Make PGDIR_SHIFT and PTRS_PER_P4D variable
Message-ID<ufoYr-2Kf-59@gated-at.bofh.it>
* Kirill A. Shutemov <kirill.shutemov@linux.intel.com> wrote:

> For boot-time switching between 4- and 5-level paging we need to be able
> to fold p4d page table level at runtime. It requires variable
> PGDIR_SHIFT and PTRS_PER_P4D.
> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> ---
>  arch/x86/boot/compressed/kaslr.c        |  5 +++++
>  arch/x86/include/asm/pgtable_32.h       |  2 ++
>  arch/x86/include/asm/pgtable_32_types.h |  2 ++
>  arch/x86/include/asm/pgtable_64_types.h | 15 +++++++++++++--
>  arch/x86/kernel/head64.c                |  9 ++++++++-
>  arch/x86/mm/dump_pagetables.c           | 12 +++++-------
>  arch/x86/mm/init_64.c                   |  2 +-
>  arch/x86/mm/kasan_init_64.c             |  2 +-
>  arch/x86/platform/efi/efi_64.c          |  4 ++--
>  include/asm-generic/5level-fixup.h      |  1 +
>  include/asm-generic/pgtable-nop4d.h     |  1 +
>  include/linux/kasan.h                   |  2 +-
>  mm/kasan/kasan_init.c                   |  2 +-
>  13 files changed, 43 insertions(+), 16 deletions(-)

So I'm wondering what the code generation effect of this is - what's the 
before/after vmlinux size?

My guess is that the effect should be very small, as these constants are not 
widely used - but I'm only guessing and could be wrong.

Thanks,

	Ingo

[toc] | [next] | [standalone]


#1713818

From"Kirill A. Shutemov" <kirill@shutemov.name>
Date2017-08-17 13:00 +0200
Message-ID<ufqGS-3Hy-3@gated-at.bofh.it>
In reply to#1713697
On Thu, Aug 17, 2017 at 11:00:38AM +0200, Ingo Molnar wrote:
> 
> * Kirill A. Shutemov <kirill.shutemov@linux.intel.com> wrote:
> 
> > For boot-time switching between 4- and 5-level paging we need to be able
> > to fold p4d page table level at runtime. It requires variable
> > PGDIR_SHIFT and PTRS_PER_P4D.
> > 
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > ---
> >  arch/x86/boot/compressed/kaslr.c        |  5 +++++
> >  arch/x86/include/asm/pgtable_32.h       |  2 ++
> >  arch/x86/include/asm/pgtable_32_types.h |  2 ++
> >  arch/x86/include/asm/pgtable_64_types.h | 15 +++++++++++++--
> >  arch/x86/kernel/head64.c                |  9 ++++++++-
> >  arch/x86/mm/dump_pagetables.c           | 12 +++++-------
> >  arch/x86/mm/init_64.c                   |  2 +-
> >  arch/x86/mm/kasan_init_64.c             |  2 +-
> >  arch/x86/platform/efi/efi_64.c          |  4 ++--
> >  include/asm-generic/5level-fixup.h      |  1 +
> >  include/asm-generic/pgtable-nop4d.h     |  1 +
> >  include/linux/kasan.h                   |  2 +-
> >  mm/kasan/kasan_init.c                   |  2 +-
> >  13 files changed, 43 insertions(+), 16 deletions(-)
> 
> So I'm wondering what the code generation effect of this is - what's the 
> before/after vmlinux size?
> 
> My guess is that the effect should be very small, as these constants are not 
> widely used - but I'm only guessing and could be wrong.

This change increase vmlinux size for defconfig + X86_5LEVEL=y by ~4k or
0.01%.

-- 
 Kirill A. Shutemov

[toc] | [prev] | [next] | [standalone]


#1713825

FromIngo Molnar <mingo@kernel.org>
Date2017-08-17 13:20 +0200
Message-ID<ufr0e-44g-13@gated-at.bofh.it>
In reply to#1713818
* Kirill A. Shutemov <kirill@shutemov.name> wrote:

> On Thu, Aug 17, 2017 at 11:00:38AM +0200, Ingo Molnar wrote:
> > 
> > * Kirill A. Shutemov <kirill.shutemov@linux.intel.com> wrote:
> > 
> > > For boot-time switching between 4- and 5-level paging we need to be able
> > > to fold p4d page table level at runtime. It requires variable
> > > PGDIR_SHIFT and PTRS_PER_P4D.
> > > 
> > > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > > ---
> > >  arch/x86/boot/compressed/kaslr.c        |  5 +++++
> > >  arch/x86/include/asm/pgtable_32.h       |  2 ++
> > >  arch/x86/include/asm/pgtable_32_types.h |  2 ++
> > >  arch/x86/include/asm/pgtable_64_types.h | 15 +++++++++++++--
> > >  arch/x86/kernel/head64.c                |  9 ++++++++-
> > >  arch/x86/mm/dump_pagetables.c           | 12 +++++-------
> > >  arch/x86/mm/init_64.c                   |  2 +-
> > >  arch/x86/mm/kasan_init_64.c             |  2 +-
> > >  arch/x86/platform/efi/efi_64.c          |  4 ++--
> > >  include/asm-generic/5level-fixup.h      |  1 +
> > >  include/asm-generic/pgtable-nop4d.h     |  1 +
> > >  include/linux/kasan.h                   |  2 +-
> > >  mm/kasan/kasan_init.c                   |  2 +-
> > >  13 files changed, 43 insertions(+), 16 deletions(-)
> > 
> > So I'm wondering what the code generation effect of this is - what's the 
> > before/after vmlinux size?
> > 
> > My guess is that the effect should be very small, as these constants are not 
> > widely used - but I'm only guessing and could be wrong.
> 
> This change increase vmlinux size for defconfig + X86_5LEVEL=y by ~4k or
> 0.01%.

Please add this info to one of the changelogs.

BTW., some of that might be won back via the later optimizations, right?

BTW, I think what matters most is the .text section size, while 'size' would also 
add exceptions/out-of-line sections too.

Here's a way to display the .text section only:

 triton:~/tip> printf "# vmlinux .text size: %d\n" 0x$(echo $(readelf -W -e vmlinux | grep ' \[ 1\] .text ') | cut -d' ' -f7)
 # vmlinux .text size: 9797610

 triton:~/tip> size vmlinux
   text    data     bss     dec     hex filename
 10748306        4875500  876544 16500350         fbc67e vmlinux

Thanks,

	Ingo

[toc] | [prev] | [next] | [standalone]


#1716596

From"Kirill A. Shutemov" <kirill@shutemov.name>
Date2017-08-21 17:30 +0200
Message-ID<ugWOm-648-11@gated-at.bofh.it>
In reply to#1713825
On Thu, Aug 17, 2017 at 01:10:05PM +0200, Ingo Molnar wrote:
> 
> * Kirill A. Shutemov <kirill@shutemov.name> wrote:
> 
> > On Thu, Aug 17, 2017 at 11:00:38AM +0200, Ingo Molnar wrote:
> > > 
> > > * Kirill A. Shutemov <kirill.shutemov@linux.intel.com> wrote:
> > > 
> > > > For boot-time switching between 4- and 5-level paging we need to be able
> > > > to fold p4d page table level at runtime. It requires variable
> > > > PGDIR_SHIFT and PTRS_PER_P4D.
> > > > 
> > > > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > > > ---
> > > >  arch/x86/boot/compressed/kaslr.c        |  5 +++++
> > > >  arch/x86/include/asm/pgtable_32.h       |  2 ++
> > > >  arch/x86/include/asm/pgtable_32_types.h |  2 ++
> > > >  arch/x86/include/asm/pgtable_64_types.h | 15 +++++++++++++--
> > > >  arch/x86/kernel/head64.c                |  9 ++++++++-
> > > >  arch/x86/mm/dump_pagetables.c           | 12 +++++-------
> > > >  arch/x86/mm/init_64.c                   |  2 +-
> > > >  arch/x86/mm/kasan_init_64.c             |  2 +-
> > > >  arch/x86/platform/efi/efi_64.c          |  4 ++--
> > > >  include/asm-generic/5level-fixup.h      |  1 +
> > > >  include/asm-generic/pgtable-nop4d.h     |  1 +
> > > >  include/linux/kasan.h                   |  2 +-
> > > >  mm/kasan/kasan_init.c                   |  2 +-
> > > >  13 files changed, 43 insertions(+), 16 deletions(-)
> > > 
> > > So I'm wondering what the code generation effect of this is - what's the 
> > > before/after vmlinux size?
> > > 
> > > My guess is that the effect should be very small, as these constants are not 
> > > widely used - but I'm only guessing and could be wrong.
> > 
> > This change increase vmlinux size for defconfig + X86_5LEVEL=y by ~4k or
> > 0.01%.
> 
> Please add this info to one of the changelogs.
> 
> BTW., some of that might be won back via the later optimizations, right?

Sorry, but no. Just chacked. Introducing alternatives increases .text
segment size by about 4k.

-- 
 Kirill A. Shutemov

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web