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


Groups > linux.kernel > #1741265

Re: [PATCHv7 02/19] mm/zsmalloc: Prepare to variable MAX_PHYSMEM_BITS

From Ingo Molnar <mingo@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCHv7 02/19] mm/zsmalloc: Prepare to variable MAX_PHYSMEM_BITS
Date 2017-09-28 10:20 +0200
Message-ID <uuCd4-6xg-11@gated-at.bofh.it> (permalink)
References <ur1Wp-5gk-5@gated-at.bofh.it> <ur265-5yD-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


* Kirill A. Shutemov <kirill.shutemov@linux.intel.com> wrote:

> With boot-time switching between paging mode we will have variable
> MAX_PHYSMEM_BITS.
> 
> Let's use the maximum variable possible for CONFIG_X86_5LEVEL=y
> configuration to define zsmalloc data structures.
> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Minchan Kim <minchan@kernel.org>
> Cc: Nitin Gupta <ngupta@vflare.org>
> Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
> ---
>  mm/zsmalloc.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index 7c38e850a8fc..fe22661f2fe5 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -93,7 +93,13 @@
>  #define MAX_PHYSMEM_BITS BITS_PER_LONG
>  #endif
>  #endif
> +
> +#ifdef CONFIG_X86_5LEVEL
> +/* MAX_PHYSMEM_BITS is variable, use maximum value here */
> +#define _PFN_BITS		(52 - PAGE_SHIFT)
> +#else
>  #define _PFN_BITS		(MAX_PHYSMEM_BITS - PAGE_SHIFT)
> +#endif

This is a totally ugly hack, polluting generic MM code with an x86-ism and an 
arbitrary hard-coded constant that would silently lose validity when x86 paging 
gets extended again ...

Thanks,

	Ingo

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


Thread

Re: [PATCHv7 02/19] mm/zsmalloc: Prepare to variable MAX_PHYSMEM_BITS Ingo Molnar <mingo@kernel.org> - 2017-09-28 10:20 +0200
  Re: [PATCHv7 02/19] mm/zsmalloc: Prepare to variable MAX_PHYSMEM_BITS "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-09-28 11:30 +0200
    Re: [PATCHv7 02/19] mm/zsmalloc: Prepare to variable MAX_PHYSMEM_BITS Ingo Molnar <mingo@kernel.org> - 2017-09-28 11:50 +0200

csiph-web