All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
  2021-12-26  8:39   ` Kefeng Wang
  (?)
@ 2021-12-26  8:33     ` Kefeng Wang
  -1 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:33 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Nicholas Piggin, Catalin Marinas, Will Deacon, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras


On 2021/12/26 16:39, Kefeng Wang wrote:
> Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
> not enable huge vmalloc mappings by default, and this could make
> more architectures to enable huge vmalloc mappings feature but
> don't want to enable it by default.
>
> Add hugevmalloc=on/off parameter to enable or disable this feature
> at boot time, nohugevmalloc is still supported and equivalent to
> hugevmalloc=off.
>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>   .../admin-guide/kernel-parameters.txt          | 12 ++++++++++++
>   arch/powerpc/Kconfig                           |  1 +
>   mm/Kconfig                                     |  7 +++++++
>   mm/vmalloc.c                                   | 18 +++++++++++++++++-
>   4 files changed, 37 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 2fba82431efb..4107136097a6 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1629,6 +1629,18 @@
>   			If both parameters are enabled, hugetlb_free_vmemmap takes
>   			precedence over memory_hotplug.memmap_on_memory.
>   
> +
> +	hugevmalloc=	[PPC] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
> +			Format: { on | off }
> +			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
> +
> +			This parameter enables/disables kernel huge vmalloc
> +			mappings at boot time.
> +
> +			on:  Enable the feature
> +			off: Disable the feature
> +			     Equivalent to: nohugevmalloc
> +
>   	hung_task_panic=
>   			[KNL] Should the hung task detector generate panics.
>   			Format: 0 | 1
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index dea74d7717c0..d59b221be264 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -246,6 +246,7 @@ config PPC
>   	select HAVE_STATIC_CALL			if PPC32
>   	select HAVE_SYSCALL_TRACEPOINTS
>   	select HAVE_VIRT_CPU_ACCOUNTING
> +	select HUGE_VMALLOC_DEFAULT_ENABLED	if HAVE_ARCH_HUGE_VMALLOC
>   	select HUGETLB_PAGE_SIZE_VARIABLE	if PPC_BOOK3S_64 && HUGETLB_PAGE
>   	select IOMMU_HELPER			if PPC64
>   	select IRQ_DOMAIN
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 356f4f2c779e..4ba91c0359bd 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -262,6 +262,13 @@ config HUGETLB_PAGE_SIZE_VARIABLE
>   	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
>   	  on a platform.
>   
> +config HUGE_VMALLOC_DEFAULT_ENABLED
> +	bool "Enable huge vmalloc mappings by default"
> +	depends on HAVE_ARCH_HUGE_VMALLOC
> +	help
> +	  Enable huge vmalloc mappings by default, this value could be overridden
> +	  by hugevmalloc=off|on.
> +
>   config CONTIG_ALLOC
>   	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
>   
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index d2a00ad4e1dd..3b6f99753816 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -58,7 +58,7 @@ static const unsigned int ioremap_max_page_shift = PAGE_SHIFT;
>   #endif	/* CONFIG_HAVE_ARCH_HUGE_VMAP */
>   
>   #ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC
> -static bool __ro_after_init vmap_allow_huge = true;
> +static bool __ro_after_init vmap_allow_huge = IS_ENABLED(CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED);
>   
>   static int __init set_nohugevmalloc(char *str)
>   {
> @@ -66,6 +66,22 @@ static int __init set_nohugevmalloc(char *str)
>   	return 0;
>   }
>   early_param("nohugevmalloc", set_nohugevmalloc);
> +
> +static int __init set_hugevmalloc(char *str)
> +{
> +	if (!str)
> +		return -EINVAL;
> +
> +	if (!strcmp(str, "on"))
> +		vmap_allow_huge = true;
> +	else if (!strcmp(str, "off"))
> +		vmap_allow_huge = true;
should vmap_allow_huge=false, my mistake...
> +	else
> +		return -EINVAL;
> +
> +	return 0;
> +}
> +early_param("hugevmalloc=", set_hugevmalloc);
>   #else /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
>   static const bool vmap_allow_huge = false;
>   #endif	/* CONFIG_HAVE_ARCH_HUGE_VMALLOC */

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
@ 2021-12-26  8:33     ` Kefeng Wang
  0 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:33 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Catalin Marinas, Dave Hansen, Nicholas Piggin, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Paul Mackerras, Thomas Gleixner,
	Will Deacon


On 2021/12/26 16:39, Kefeng Wang wrote:
> Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
> not enable huge vmalloc mappings by default, and this could make
> more architectures to enable huge vmalloc mappings feature but
> don't want to enable it by default.
>
> Add hugevmalloc=on/off parameter to enable or disable this feature
> at boot time, nohugevmalloc is still supported and equivalent to
> hugevmalloc=off.
>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>   .../admin-guide/kernel-parameters.txt          | 12 ++++++++++++
>   arch/powerpc/Kconfig                           |  1 +
>   mm/Kconfig                                     |  7 +++++++
>   mm/vmalloc.c                                   | 18 +++++++++++++++++-
>   4 files changed, 37 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 2fba82431efb..4107136097a6 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1629,6 +1629,18 @@
>   			If both parameters are enabled, hugetlb_free_vmemmap takes
>   			precedence over memory_hotplug.memmap_on_memory.
>   
> +
> +	hugevmalloc=	[PPC] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
> +			Format: { on | off }
> +			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
> +
> +			This parameter enables/disables kernel huge vmalloc
> +			mappings at boot time.
> +
> +			on:  Enable the feature
> +			off: Disable the feature
> +			     Equivalent to: nohugevmalloc
> +
>   	hung_task_panic=
>   			[KNL] Should the hung task detector generate panics.
>   			Format: 0 | 1
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index dea74d7717c0..d59b221be264 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -246,6 +246,7 @@ config PPC
>   	select HAVE_STATIC_CALL			if PPC32
>   	select HAVE_SYSCALL_TRACEPOINTS
>   	select HAVE_VIRT_CPU_ACCOUNTING
> +	select HUGE_VMALLOC_DEFAULT_ENABLED	if HAVE_ARCH_HUGE_VMALLOC
>   	select HUGETLB_PAGE_SIZE_VARIABLE	if PPC_BOOK3S_64 && HUGETLB_PAGE
>   	select IOMMU_HELPER			if PPC64
>   	select IRQ_DOMAIN
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 356f4f2c779e..4ba91c0359bd 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -262,6 +262,13 @@ config HUGETLB_PAGE_SIZE_VARIABLE
>   	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
>   	  on a platform.
>   
> +config HUGE_VMALLOC_DEFAULT_ENABLED
> +	bool "Enable huge vmalloc mappings by default"
> +	depends on HAVE_ARCH_HUGE_VMALLOC
> +	help
> +	  Enable huge vmalloc mappings by default, this value could be overridden
> +	  by hugevmalloc=off|on.
> +
>   config CONTIG_ALLOC
>   	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
>   
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index d2a00ad4e1dd..3b6f99753816 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -58,7 +58,7 @@ static const unsigned int ioremap_max_page_shift = PAGE_SHIFT;
>   #endif	/* CONFIG_HAVE_ARCH_HUGE_VMAP */
>   
>   #ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC
> -static bool __ro_after_init vmap_allow_huge = true;
> +static bool __ro_after_init vmap_allow_huge = IS_ENABLED(CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED);
>   
>   static int __init set_nohugevmalloc(char *str)
>   {
> @@ -66,6 +66,22 @@ static int __init set_nohugevmalloc(char *str)
>   	return 0;
>   }
>   early_param("nohugevmalloc", set_nohugevmalloc);
> +
> +static int __init set_hugevmalloc(char *str)
> +{
> +	if (!str)
> +		return -EINVAL;
> +
> +	if (!strcmp(str, "on"))
> +		vmap_allow_huge = true;
> +	else if (!strcmp(str, "off"))
> +		vmap_allow_huge = true;
should vmap_allow_huge=false, my mistake...
> +	else
> +		return -EINVAL;
> +
> +	return 0;
> +}
> +early_param("hugevmalloc=", set_hugevmalloc);
>   #else /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
>   static const bool vmap_allow_huge = false;
>   #endif	/* CONFIG_HAVE_ARCH_HUGE_VMALLOC */

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
@ 2021-12-26  8:33     ` Kefeng Wang
  0 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:33 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Nicholas Piggin, Catalin Marinas, Will Deacon, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras


On 2021/12/26 16:39, Kefeng Wang wrote:
> Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
> not enable huge vmalloc mappings by default, and this could make
> more architectures to enable huge vmalloc mappings feature but
> don't want to enable it by default.
>
> Add hugevmalloc=on/off parameter to enable or disable this feature
> at boot time, nohugevmalloc is still supported and equivalent to
> hugevmalloc=off.
>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>   .../admin-guide/kernel-parameters.txt          | 12 ++++++++++++
>   arch/powerpc/Kconfig                           |  1 +
>   mm/Kconfig                                     |  7 +++++++
>   mm/vmalloc.c                                   | 18 +++++++++++++++++-
>   4 files changed, 37 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 2fba82431efb..4107136097a6 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1629,6 +1629,18 @@
>   			If both parameters are enabled, hugetlb_free_vmemmap takes
>   			precedence over memory_hotplug.memmap_on_memory.
>   
> +
> +	hugevmalloc=	[PPC] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
> +			Format: { on | off }
> +			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
> +
> +			This parameter enables/disables kernel huge vmalloc
> +			mappings at boot time.
> +
> +			on:  Enable the feature
> +			off: Disable the feature
> +			     Equivalent to: nohugevmalloc
> +
>   	hung_task_panic=
>   			[KNL] Should the hung task detector generate panics.
>   			Format: 0 | 1
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index dea74d7717c0..d59b221be264 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -246,6 +246,7 @@ config PPC
>   	select HAVE_STATIC_CALL			if PPC32
>   	select HAVE_SYSCALL_TRACEPOINTS
>   	select HAVE_VIRT_CPU_ACCOUNTING
> +	select HUGE_VMALLOC_DEFAULT_ENABLED	if HAVE_ARCH_HUGE_VMALLOC
>   	select HUGETLB_PAGE_SIZE_VARIABLE	if PPC_BOOK3S_64 && HUGETLB_PAGE
>   	select IOMMU_HELPER			if PPC64
>   	select IRQ_DOMAIN
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 356f4f2c779e..4ba91c0359bd 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -262,6 +262,13 @@ config HUGETLB_PAGE_SIZE_VARIABLE
>   	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
>   	  on a platform.
>   
> +config HUGE_VMALLOC_DEFAULT_ENABLED
> +	bool "Enable huge vmalloc mappings by default"
> +	depends on HAVE_ARCH_HUGE_VMALLOC
> +	help
> +	  Enable huge vmalloc mappings by default, this value could be overridden
> +	  by hugevmalloc=off|on.
> +
>   config CONTIG_ALLOC
>   	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
>   
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index d2a00ad4e1dd..3b6f99753816 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -58,7 +58,7 @@ static const unsigned int ioremap_max_page_shift = PAGE_SHIFT;
>   #endif	/* CONFIG_HAVE_ARCH_HUGE_VMAP */
>   
>   #ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC
> -static bool __ro_after_init vmap_allow_huge = true;
> +static bool __ro_after_init vmap_allow_huge = IS_ENABLED(CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED);
>   
>   static int __init set_nohugevmalloc(char *str)
>   {
> @@ -66,6 +66,22 @@ static int __init set_nohugevmalloc(char *str)
>   	return 0;
>   }
>   early_param("nohugevmalloc", set_nohugevmalloc);
> +
> +static int __init set_hugevmalloc(char *str)
> +{
> +	if (!str)
> +		return -EINVAL;
> +
> +	if (!strcmp(str, "on"))
> +		vmap_allow_huge = true;
> +	else if (!strcmp(str, "off"))
> +		vmap_allow_huge = true;
should vmap_allow_huge=false, my mistake...
> +	else
> +		return -EINVAL;
> +
> +	return 0;
> +}
> +early_param("hugevmalloc=", set_hugevmalloc);
>   #else /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
>   static const bool vmap_allow_huge = false;
>   #endif	/* CONFIG_HAVE_ARCH_HUGE_VMALLOC */

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 0/3] mm: support huge vmalloc mapping on arm64/x86
@ 2021-12-26  8:39 ` Kefeng Wang
  0 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:39 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Nicholas Piggin, Catalin Marinas, Will Deacon, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Kefeng Wang

huge vmalloc mappings is supported on PPC[1], but this feature should
be not only used on PPC, it could be used on arch support HAVE_ARCH_HUGE_VMAP
and PMD sized vmap mappings. this patchset is to enable this feature
on arm64/x86.

The first patch is to let user to control huge vmalloc mapping default
behavior and then enable this feature on arm64/x86.

The PPC is enabled by default(it selects HUGE_VMALLOC_DEFAULT_ENABLED),
but arm64/x86 should use hugevmalloc=on to enable this feature.

NOTE:
1) nohugevmalloc parameter is still supported, the first patch is in
   case of archs don't want to this feature enabled by default.
2) if people don't like this, we could drop the first patch.

[1] https://lore.kernel.org/linux-mm/20210317062402.533919-1-npiggin@gmail.com/

Kefeng Wang (3):
  mm: vmalloc: Let user to control huge vmalloc default behavior
  arm64: Support huge vmalloc mappings
  x86: Support huge vmalloc mappings

 .../admin-guide/kernel-parameters.txt          | 14 +++++++++++++-
 arch/arm64/Kconfig                             |  1 +
 arch/powerpc/Kconfig                           |  1 +
 arch/x86/Kconfig                               |  1 +
 mm/Kconfig                                     |  7 +++++++
 mm/vmalloc.c                                   | 18 +++++++++++++++++-
 6 files changed, 40 insertions(+), 2 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 0/3] mm: support huge vmalloc mapping on arm64/x86
@ 2021-12-26  8:39 ` Kefeng Wang
  0 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:39 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Kefeng Wang, Catalin Marinas, Dave Hansen, Nicholas Piggin,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, Paul Mackerras,
	Thomas Gleixner, Will Deacon

huge vmalloc mappings is supported on PPC[1], but this feature should
be not only used on PPC, it could be used on arch support HAVE_ARCH_HUGE_VMAP
and PMD sized vmap mappings. this patchset is to enable this feature
on arm64/x86.

The first patch is to let user to control huge vmalloc mapping default
behavior and then enable this feature on arm64/x86.

The PPC is enabled by default(it selects HUGE_VMALLOC_DEFAULT_ENABLED),
but arm64/x86 should use hugevmalloc=on to enable this feature.

NOTE:
1) nohugevmalloc parameter is still supported, the first patch is in
   case of archs don't want to this feature enabled by default.
2) if people don't like this, we could drop the first patch.

[1] https://lore.kernel.org/linux-mm/20210317062402.533919-1-npiggin@gmail.com/

Kefeng Wang (3):
  mm: vmalloc: Let user to control huge vmalloc default behavior
  arm64: Support huge vmalloc mappings
  x86: Support huge vmalloc mappings

 .../admin-guide/kernel-parameters.txt          | 14 +++++++++++++-
 arch/arm64/Kconfig                             |  1 +
 arch/powerpc/Kconfig                           |  1 +
 arch/x86/Kconfig                               |  1 +
 mm/Kconfig                                     |  7 +++++++
 mm/vmalloc.c                                   | 18 +++++++++++++++++-
 6 files changed, 40 insertions(+), 2 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 0/3] mm: support huge vmalloc mapping on arm64/x86
@ 2021-12-26  8:39 ` Kefeng Wang
  0 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:39 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Nicholas Piggin, Catalin Marinas, Will Deacon, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Kefeng Wang

huge vmalloc mappings is supported on PPC[1], but this feature should
be not only used on PPC, it could be used on arch support HAVE_ARCH_HUGE_VMAP
and PMD sized vmap mappings. this patchset is to enable this feature
on arm64/x86.

The first patch is to let user to control huge vmalloc mapping default
behavior and then enable this feature on arm64/x86.

The PPC is enabled by default(it selects HUGE_VMALLOC_DEFAULT_ENABLED),
but arm64/x86 should use hugevmalloc=on to enable this feature.

NOTE:
1) nohugevmalloc parameter is still supported, the first patch is in
   case of archs don't want to this feature enabled by default.
2) if people don't like this, we could drop the first patch.

[1] https://lore.kernel.org/linux-mm/20210317062402.533919-1-npiggin@gmail.com/

Kefeng Wang (3):
  mm: vmalloc: Let user to control huge vmalloc default behavior
  arm64: Support huge vmalloc mappings
  x86: Support huge vmalloc mappings

 .../admin-guide/kernel-parameters.txt          | 14 +++++++++++++-
 arch/arm64/Kconfig                             |  1 +
 arch/powerpc/Kconfig                           |  1 +
 arch/x86/Kconfig                               |  1 +
 mm/Kconfig                                     |  7 +++++++
 mm/vmalloc.c                                   | 18 +++++++++++++++++-
 6 files changed, 40 insertions(+), 2 deletions(-)

-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
  2021-12-26  8:39 ` Kefeng Wang
  (?)
@ 2021-12-26  8:39   ` Kefeng Wang
  -1 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:39 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Nicholas Piggin, Catalin Marinas, Will Deacon, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Kefeng Wang

Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
not enable huge vmalloc mappings by default, and this could make
more architectures to enable huge vmalloc mappings feature but
don't want to enable it by default.

Add hugevmalloc=on/off parameter to enable or disable this feature
at boot time, nohugevmalloc is still supported and equivalent to
hugevmalloc=off.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 .../admin-guide/kernel-parameters.txt          | 12 ++++++++++++
 arch/powerpc/Kconfig                           |  1 +
 mm/Kconfig                                     |  7 +++++++
 mm/vmalloc.c                                   | 18 +++++++++++++++++-
 4 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 2fba82431efb..4107136097a6 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1629,6 +1629,18 @@
 			If both parameters are enabled, hugetlb_free_vmemmap takes
 			precedence over memory_hotplug.memmap_on_memory.
 
+
+	hugevmalloc=	[PPC] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
+			Format: { on | off }
+			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
+
+			This parameter enables/disables kernel huge vmalloc
+			mappings at boot time.
+
+			on:  Enable the feature
+			off: Disable the feature
+			     Equivalent to: nohugevmalloc
+
 	hung_task_panic=
 			[KNL] Should the hung task detector generate panics.
 			Format: 0 | 1
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index dea74d7717c0..d59b221be264 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -246,6 +246,7 @@ config PPC
 	select HAVE_STATIC_CALL			if PPC32
 	select HAVE_SYSCALL_TRACEPOINTS
 	select HAVE_VIRT_CPU_ACCOUNTING
+	select HUGE_VMALLOC_DEFAULT_ENABLED	if HAVE_ARCH_HUGE_VMALLOC
 	select HUGETLB_PAGE_SIZE_VARIABLE	if PPC_BOOK3S_64 && HUGETLB_PAGE
 	select IOMMU_HELPER			if PPC64
 	select IRQ_DOMAIN
diff --git a/mm/Kconfig b/mm/Kconfig
index 356f4f2c779e..4ba91c0359bd 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -262,6 +262,13 @@ config HUGETLB_PAGE_SIZE_VARIABLE
 	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
 	  on a platform.
 
+config HUGE_VMALLOC_DEFAULT_ENABLED
+	bool "Enable huge vmalloc mappings by default"
+	depends on HAVE_ARCH_HUGE_VMALLOC
+	help
+	  Enable huge vmalloc mappings by default, this value could be overridden
+	  by hugevmalloc=off|on.
+
 config CONTIG_ALLOC
 	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
 
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index d2a00ad4e1dd..3b6f99753816 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -58,7 +58,7 @@ static const unsigned int ioremap_max_page_shift = PAGE_SHIFT;
 #endif	/* CONFIG_HAVE_ARCH_HUGE_VMAP */
 
 #ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC
-static bool __ro_after_init vmap_allow_huge = true;
+static bool __ro_after_init vmap_allow_huge = IS_ENABLED(CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED);
 
 static int __init set_nohugevmalloc(char *str)
 {
@@ -66,6 +66,22 @@ static int __init set_nohugevmalloc(char *str)
 	return 0;
 }
 early_param("nohugevmalloc", set_nohugevmalloc);
+
+static int __init set_hugevmalloc(char *str)
+{
+	if (!str)
+		return -EINVAL;
+
+	if (!strcmp(str, "on"))
+		vmap_allow_huge = true;
+	else if (!strcmp(str, "off"))
+		vmap_allow_huge = true;
+	else
+		return -EINVAL;
+
+	return 0;
+}
+early_param("hugevmalloc=", set_hugevmalloc);
 #else /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
 static const bool vmap_allow_huge = false;
 #endif	/* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
@ 2021-12-26  8:39   ` Kefeng Wang
  0 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:39 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Kefeng Wang, Catalin Marinas, Dave Hansen, Nicholas Piggin,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, Paul Mackerras,
	Thomas Gleixner, Will Deacon

Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
not enable huge vmalloc mappings by default, and this could make
more architectures to enable huge vmalloc mappings feature but
don't want to enable it by default.

Add hugevmalloc=on/off parameter to enable or disable this feature
at boot time, nohugevmalloc is still supported and equivalent to
hugevmalloc=off.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 .../admin-guide/kernel-parameters.txt          | 12 ++++++++++++
 arch/powerpc/Kconfig                           |  1 +
 mm/Kconfig                                     |  7 +++++++
 mm/vmalloc.c                                   | 18 +++++++++++++++++-
 4 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 2fba82431efb..4107136097a6 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1629,6 +1629,18 @@
 			If both parameters are enabled, hugetlb_free_vmemmap takes
 			precedence over memory_hotplug.memmap_on_memory.
 
+
+	hugevmalloc=	[PPC] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
+			Format: { on | off }
+			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
+
+			This parameter enables/disables kernel huge vmalloc
+			mappings at boot time.
+
+			on:  Enable the feature
+			off: Disable the feature
+			     Equivalent to: nohugevmalloc
+
 	hung_task_panic=
 			[KNL] Should the hung task detector generate panics.
 			Format: 0 | 1
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index dea74d7717c0..d59b221be264 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -246,6 +246,7 @@ config PPC
 	select HAVE_STATIC_CALL			if PPC32
 	select HAVE_SYSCALL_TRACEPOINTS
 	select HAVE_VIRT_CPU_ACCOUNTING
+	select HUGE_VMALLOC_DEFAULT_ENABLED	if HAVE_ARCH_HUGE_VMALLOC
 	select HUGETLB_PAGE_SIZE_VARIABLE	if PPC_BOOK3S_64 && HUGETLB_PAGE
 	select IOMMU_HELPER			if PPC64
 	select IRQ_DOMAIN
diff --git a/mm/Kconfig b/mm/Kconfig
index 356f4f2c779e..4ba91c0359bd 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -262,6 +262,13 @@ config HUGETLB_PAGE_SIZE_VARIABLE
 	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
 	  on a platform.
 
+config HUGE_VMALLOC_DEFAULT_ENABLED
+	bool "Enable huge vmalloc mappings by default"
+	depends on HAVE_ARCH_HUGE_VMALLOC
+	help
+	  Enable huge vmalloc mappings by default, this value could be overridden
+	  by hugevmalloc=off|on.
+
 config CONTIG_ALLOC
 	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
 
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index d2a00ad4e1dd..3b6f99753816 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -58,7 +58,7 @@ static const unsigned int ioremap_max_page_shift = PAGE_SHIFT;
 #endif	/* CONFIG_HAVE_ARCH_HUGE_VMAP */
 
 #ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC
-static bool __ro_after_init vmap_allow_huge = true;
+static bool __ro_after_init vmap_allow_huge = IS_ENABLED(CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED);
 
 static int __init set_nohugevmalloc(char *str)
 {
@@ -66,6 +66,22 @@ static int __init set_nohugevmalloc(char *str)
 	return 0;
 }
 early_param("nohugevmalloc", set_nohugevmalloc);
+
+static int __init set_hugevmalloc(char *str)
+{
+	if (!str)
+		return -EINVAL;
+
+	if (!strcmp(str, "on"))
+		vmap_allow_huge = true;
+	else if (!strcmp(str, "off"))
+		vmap_allow_huge = true;
+	else
+		return -EINVAL;
+
+	return 0;
+}
+early_param("hugevmalloc=", set_hugevmalloc);
 #else /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
 static const bool vmap_allow_huge = false;
 #endif	/* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
@ 2021-12-26  8:39   ` Kefeng Wang
  0 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:39 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Nicholas Piggin, Catalin Marinas, Will Deacon, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Kefeng Wang

Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
not enable huge vmalloc mappings by default, and this could make
more architectures to enable huge vmalloc mappings feature but
don't want to enable it by default.

Add hugevmalloc=on/off parameter to enable or disable this feature
at boot time, nohugevmalloc is still supported and equivalent to
hugevmalloc=off.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 .../admin-guide/kernel-parameters.txt          | 12 ++++++++++++
 arch/powerpc/Kconfig                           |  1 +
 mm/Kconfig                                     |  7 +++++++
 mm/vmalloc.c                                   | 18 +++++++++++++++++-
 4 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 2fba82431efb..4107136097a6 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1629,6 +1629,18 @@
 			If both parameters are enabled, hugetlb_free_vmemmap takes
 			precedence over memory_hotplug.memmap_on_memory.
 
+
+	hugevmalloc=	[PPC] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
+			Format: { on | off }
+			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
+
+			This parameter enables/disables kernel huge vmalloc
+			mappings at boot time.
+
+			on:  Enable the feature
+			off: Disable the feature
+			     Equivalent to: nohugevmalloc
+
 	hung_task_panic=
 			[KNL] Should the hung task detector generate panics.
 			Format: 0 | 1
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index dea74d7717c0..d59b221be264 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -246,6 +246,7 @@ config PPC
 	select HAVE_STATIC_CALL			if PPC32
 	select HAVE_SYSCALL_TRACEPOINTS
 	select HAVE_VIRT_CPU_ACCOUNTING
+	select HUGE_VMALLOC_DEFAULT_ENABLED	if HAVE_ARCH_HUGE_VMALLOC
 	select HUGETLB_PAGE_SIZE_VARIABLE	if PPC_BOOK3S_64 && HUGETLB_PAGE
 	select IOMMU_HELPER			if PPC64
 	select IRQ_DOMAIN
diff --git a/mm/Kconfig b/mm/Kconfig
index 356f4f2c779e..4ba91c0359bd 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -262,6 +262,13 @@ config HUGETLB_PAGE_SIZE_VARIABLE
 	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
 	  on a platform.
 
+config HUGE_VMALLOC_DEFAULT_ENABLED
+	bool "Enable huge vmalloc mappings by default"
+	depends on HAVE_ARCH_HUGE_VMALLOC
+	help
+	  Enable huge vmalloc mappings by default, this value could be overridden
+	  by hugevmalloc=off|on.
+
 config CONTIG_ALLOC
 	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
 
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index d2a00ad4e1dd..3b6f99753816 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -58,7 +58,7 @@ static const unsigned int ioremap_max_page_shift = PAGE_SHIFT;
 #endif	/* CONFIG_HAVE_ARCH_HUGE_VMAP */
 
 #ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC
-static bool __ro_after_init vmap_allow_huge = true;
+static bool __ro_after_init vmap_allow_huge = IS_ENABLED(CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED);
 
 static int __init set_nohugevmalloc(char *str)
 {
@@ -66,6 +66,22 @@ static int __init set_nohugevmalloc(char *str)
 	return 0;
 }
 early_param("nohugevmalloc", set_nohugevmalloc);
+
+static int __init set_hugevmalloc(char *str)
+{
+	if (!str)
+		return -EINVAL;
+
+	if (!strcmp(str, "on"))
+		vmap_allow_huge = true;
+	else if (!strcmp(str, "off"))
+		vmap_allow_huge = true;
+	else
+		return -EINVAL;
+
+	return 0;
+}
+early_param("hugevmalloc=", set_hugevmalloc);
 #else /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
 static const bool vmap_allow_huge = false;
 #endif	/* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 2/3] arm64: Support huge vmalloc mappings
  2021-12-26  8:39 ` Kefeng Wang
  (?)
@ 2021-12-26  8:39   ` Kefeng Wang
  -1 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:39 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Nicholas Piggin, Catalin Marinas, Will Deacon, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Kefeng Wang

This patch select HAVE_ARCH_HUGE_VMALLOC to let arm64 support huge
vmalloc mappings, it is disabled by default, use hugevmalloc=on to
enable it in some scenarios.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 Documentation/admin-guide/kernel-parameters.txt | 4 ++--
 arch/arm64/Kconfig                              | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 4107136097a6..235a23b08809 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1630,7 +1630,7 @@
 			precedence over memory_hotplug.memmap_on_memory.
 
 
-	hugevmalloc=	[PPC] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
+	hugevmalloc=	[KNL,PPC,ARM64] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
 			Format: { on | off }
 			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
 
@@ -3415,7 +3415,7 @@
 
 	nohugeiomap	[KNL,X86,PPC,ARM64] Disable kernel huge I/O mappings.
 
-	nohugevmalloc	[PPC] Disable kernel huge vmalloc mappings.
+	nohugevmalloc	[KNL,PPC,ARM64] Disable kernel huge vmalloc mappings.
 
 	nosmt		[KNL,S390] Disable symmetric multithreading (SMT).
 			Equivalent to smt=1.
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index c4207cf9bb17..6cedb06b4cab 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -143,6 +143,7 @@ config ARM64
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_BITREVERSE
 	select HAVE_ARCH_COMPILER_H
+	select HAVE_ARCH_HUGE_VMALLOC
 	select HAVE_ARCH_HUGE_VMAP
 	select HAVE_ARCH_JUMP_LABEL
 	select HAVE_ARCH_JUMP_LABEL_RELATIVE
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 2/3] arm64: Support huge vmalloc mappings
@ 2021-12-26  8:39   ` Kefeng Wang
  0 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:39 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Kefeng Wang, Catalin Marinas, Dave Hansen, Nicholas Piggin,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, Paul Mackerras,
	Thomas Gleixner, Will Deacon

This patch select HAVE_ARCH_HUGE_VMALLOC to let arm64 support huge
vmalloc mappings, it is disabled by default, use hugevmalloc=on to
enable it in some scenarios.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 Documentation/admin-guide/kernel-parameters.txt | 4 ++--
 arch/arm64/Kconfig                              | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 4107136097a6..235a23b08809 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1630,7 +1630,7 @@
 			precedence over memory_hotplug.memmap_on_memory.
 
 
-	hugevmalloc=	[PPC] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
+	hugevmalloc=	[KNL,PPC,ARM64] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
 			Format: { on | off }
 			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
 
@@ -3415,7 +3415,7 @@
 
 	nohugeiomap	[KNL,X86,PPC,ARM64] Disable kernel huge I/O mappings.
 
-	nohugevmalloc	[PPC] Disable kernel huge vmalloc mappings.
+	nohugevmalloc	[KNL,PPC,ARM64] Disable kernel huge vmalloc mappings.
 
 	nosmt		[KNL,S390] Disable symmetric multithreading (SMT).
 			Equivalent to smt=1.
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index c4207cf9bb17..6cedb06b4cab 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -143,6 +143,7 @@ config ARM64
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_BITREVERSE
 	select HAVE_ARCH_COMPILER_H
+	select HAVE_ARCH_HUGE_VMALLOC
 	select HAVE_ARCH_HUGE_VMAP
 	select HAVE_ARCH_JUMP_LABEL
 	select HAVE_ARCH_JUMP_LABEL_RELATIVE
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 2/3] arm64: Support huge vmalloc mappings
@ 2021-12-26  8:39   ` Kefeng Wang
  0 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:39 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Nicholas Piggin, Catalin Marinas, Will Deacon, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Kefeng Wang

This patch select HAVE_ARCH_HUGE_VMALLOC to let arm64 support huge
vmalloc mappings, it is disabled by default, use hugevmalloc=on to
enable it in some scenarios.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 Documentation/admin-guide/kernel-parameters.txt | 4 ++--
 arch/arm64/Kconfig                              | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 4107136097a6..235a23b08809 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1630,7 +1630,7 @@
 			precedence over memory_hotplug.memmap_on_memory.
 
 
-	hugevmalloc=	[PPC] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
+	hugevmalloc=	[KNL,PPC,ARM64] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
 			Format: { on | off }
 			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
 
@@ -3415,7 +3415,7 @@
 
 	nohugeiomap	[KNL,X86,PPC,ARM64] Disable kernel huge I/O mappings.
 
-	nohugevmalloc	[PPC] Disable kernel huge vmalloc mappings.
+	nohugevmalloc	[KNL,PPC,ARM64] Disable kernel huge vmalloc mappings.
 
 	nosmt		[KNL,S390] Disable symmetric multithreading (SMT).
 			Equivalent to smt=1.
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index c4207cf9bb17..6cedb06b4cab 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -143,6 +143,7 @@ config ARM64
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_BITREVERSE
 	select HAVE_ARCH_COMPILER_H
+	select HAVE_ARCH_HUGE_VMALLOC
 	select HAVE_ARCH_HUGE_VMAP
 	select HAVE_ARCH_JUMP_LABEL
 	select HAVE_ARCH_JUMP_LABEL_RELATIVE
-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 3/3] x86: Support huge vmalloc mappings
  2021-12-26  8:39 ` Kefeng Wang
  (?)
@ 2021-12-26  8:39   ` Kefeng Wang
  -1 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:39 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Nicholas Piggin, Catalin Marinas, Will Deacon, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Kefeng Wang

This patch select HAVE_ARCH_HUGE_VMALLOC to let X86_64 and X86_PAE
support huge vmalloc mappings, it is disabled by default, use
hugevmalloc=on to enable it.

Cc: Thomas Gleixner <tglx@linutronix.de> 
Cc: Ingo Molnar <mingo@redhat.com> 
Cc: Borislav Petkov <bp@alien8.de> 
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 Documentation/admin-guide/kernel-parameters.txt | 4 ++--
 arch/x86/Kconfig                                | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 235a23b08809..5c8780e66be2 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1630,7 +1630,7 @@
 			precedence over memory_hotplug.memmap_on_memory.
 
 
-	hugevmalloc=	[KNL,PPC,ARM64] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
+	hugevmalloc=	[KNL,PPC,ARM64,X86] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
 			Format: { on | off }
 			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
 
@@ -3415,7 +3415,7 @@
 
 	nohugeiomap	[KNL,X86,PPC,ARM64] Disable kernel huge I/O mappings.
 
-	nohugevmalloc	[KNL,PPC,ARM64] Disable kernel huge vmalloc mappings.
+	nohugevmalloc	[KNL,PPC,ARM64,X86] Disable kernel huge vmalloc mappings.
 
 	nosmt		[KNL,S390] Disable symmetric multithreading (SMT).
 			Equivalent to smt=1.
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5c2ccb85f2ef..31e465fecd01 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -157,6 +157,7 @@ config X86
 	select HAVE_ACPI_APEI_NMI		if ACPI
 	select HAVE_ALIGNED_STRUCT_PAGE		if SLUB
 	select HAVE_ARCH_AUDITSYSCALL
+	select HAVE_ARCH_HUGE_VMALLOC		if HAVE_ARCH_HUGE_VMAP
 	select HAVE_ARCH_HUGE_VMAP		if X86_64 || X86_PAE
 	select HAVE_ARCH_JUMP_LABEL
 	select HAVE_ARCH_JUMP_LABEL_RELATIVE
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 3/3] x86: Support huge vmalloc mappings
@ 2021-12-26  8:39   ` Kefeng Wang
  0 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:39 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Kefeng Wang, Catalin Marinas, Dave Hansen, Nicholas Piggin,
	Ingo Molnar, Borislav Petkov, H. Peter Anvin, Paul Mackerras,
	Thomas Gleixner, Will Deacon

This patch select HAVE_ARCH_HUGE_VMALLOC to let X86_64 and X86_PAE
support huge vmalloc mappings, it is disabled by default, use
hugevmalloc=on to enable it.

Cc: Thomas Gleixner <tglx@linutronix.de> 
Cc: Ingo Molnar <mingo@redhat.com> 
Cc: Borislav Petkov <bp@alien8.de> 
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 Documentation/admin-guide/kernel-parameters.txt | 4 ++--
 arch/x86/Kconfig                                | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 235a23b08809..5c8780e66be2 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1630,7 +1630,7 @@
 			precedence over memory_hotplug.memmap_on_memory.
 
 
-	hugevmalloc=	[KNL,PPC,ARM64] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
+	hugevmalloc=	[KNL,PPC,ARM64,X86] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
 			Format: { on | off }
 			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
 
@@ -3415,7 +3415,7 @@
 
 	nohugeiomap	[KNL,X86,PPC,ARM64] Disable kernel huge I/O mappings.
 
-	nohugevmalloc	[KNL,PPC,ARM64] Disable kernel huge vmalloc mappings.
+	nohugevmalloc	[KNL,PPC,ARM64,X86] Disable kernel huge vmalloc mappings.
 
 	nosmt		[KNL,S390] Disable symmetric multithreading (SMT).
 			Equivalent to smt=1.
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5c2ccb85f2ef..31e465fecd01 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -157,6 +157,7 @@ config X86
 	select HAVE_ACPI_APEI_NMI		if ACPI
 	select HAVE_ALIGNED_STRUCT_PAGE		if SLUB
 	select HAVE_ARCH_AUDITSYSCALL
+	select HAVE_ARCH_HUGE_VMALLOC		if HAVE_ARCH_HUGE_VMAP
 	select HAVE_ARCH_HUGE_VMAP		if X86_64 || X86_PAE
 	select HAVE_ARCH_JUMP_LABEL
 	select HAVE_ARCH_JUMP_LABEL_RELATIVE
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 3/3] x86: Support huge vmalloc mappings
@ 2021-12-26  8:39   ` Kefeng Wang
  0 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-26  8:39 UTC (permalink / raw)
  To: Jonathan Corbet, Andrew Morton, linuxppc-dev, linux-doc,
	linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Nicholas Piggin, Catalin Marinas, Will Deacon, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Kefeng Wang

This patch select HAVE_ARCH_HUGE_VMALLOC to let X86_64 and X86_PAE
support huge vmalloc mappings, it is disabled by default, use
hugevmalloc=on to enable it.

Cc: Thomas Gleixner <tglx@linutronix.de> 
Cc: Ingo Molnar <mingo@redhat.com> 
Cc: Borislav Petkov <bp@alien8.de> 
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 Documentation/admin-guide/kernel-parameters.txt | 4 ++--
 arch/x86/Kconfig                                | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 235a23b08809..5c8780e66be2 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1630,7 +1630,7 @@
 			precedence over memory_hotplug.memmap_on_memory.
 
 
-	hugevmalloc=	[KNL,PPC,ARM64] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
+	hugevmalloc=	[KNL,PPC,ARM64,X86] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
 			Format: { on | off }
 			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
 
@@ -3415,7 +3415,7 @@
 
 	nohugeiomap	[KNL,X86,PPC,ARM64] Disable kernel huge I/O mappings.
 
-	nohugevmalloc	[KNL,PPC,ARM64] Disable kernel huge vmalloc mappings.
+	nohugevmalloc	[KNL,PPC,ARM64,X86] Disable kernel huge vmalloc mappings.
 
 	nosmt		[KNL,S390] Disable symmetric multithreading (SMT).
 			Equivalent to smt=1.
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5c2ccb85f2ef..31e465fecd01 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -157,6 +157,7 @@ config X86
 	select HAVE_ACPI_APEI_NMI		if ACPI
 	select HAVE_ALIGNED_STRUCT_PAGE		if SLUB
 	select HAVE_ARCH_AUDITSYSCALL
+	select HAVE_ARCH_HUGE_VMALLOC		if HAVE_ARCH_HUGE_VMAP
 	select HAVE_ARCH_HUGE_VMAP		if X86_64 || X86_PAE
 	select HAVE_ARCH_JUMP_LABEL
 	select HAVE_ARCH_JUMP_LABEL_RELATIVE
-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
  2021-12-26  8:39   ` Kefeng Wang
@ 2021-12-26 17:36     ` Christophe Leroy
  -1 siblings, 0 replies; 25+ messages in thread
From: Christophe Leroy @ 2021-12-26 17:36 UTC (permalink / raw)
  To: Kefeng Wang, Jonathan Corbet, Andrew Morton, linuxppc-dev,
	linux-doc, linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Catalin Marinas, Dave Hansen, Nicholas Piggin, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Paul Mackerras, Thomas Gleixner,
	Will Deacon



Le 26/12/2021 à 09:39, Kefeng Wang a écrit :
> Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
> not enable huge vmalloc mappings by default, and this could make
> more architectures to enable huge vmalloc mappings feature but
> don't want to enable it by default.
> 
> Add hugevmalloc=on/off parameter to enable or disable this feature
> at boot time, nohugevmalloc is still supported and equivalent to
> hugevmalloc=off.


Is there a real added value to have the user be able to select that ?

If the architecture supports it, is there any good reason to not use it ?

Why not just do like PPC and enable it by default ? Why should it be 
enabled by default on PPC but disabled by default on ARM64 and X86 ?


> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>   .../admin-guide/kernel-parameters.txt          | 12 ++++++++++++
>   arch/powerpc/Kconfig                           |  1 +
>   mm/Kconfig                                     |  7 +++++++
>   mm/vmalloc.c                                   | 18 +++++++++++++++++-
>   4 files changed, 37 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 2fba82431efb..4107136097a6 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1629,6 +1629,18 @@
>   			If both parameters are enabled, hugetlb_free_vmemmap takes
>   			precedence over memory_hotplug.memmap_on_memory.
>   
> +
> +	hugevmalloc=	[PPC] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
> +			Format: { on | off }
> +			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
> +
> +			This parameter enables/disables kernel huge vmalloc
> +			mappings at boot time.
> +
> +			on:  Enable the feature
> +			off: Disable the feature
> +			     Equivalent to: nohugevmalloc
> +
>   	hung_task_panic=
>   			[KNL] Should the hung task detector generate panics.
>   			Format: 0 | 1
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index dea74d7717c0..d59b221be264 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -246,6 +246,7 @@ config PPC
>   	select HAVE_STATIC_CALL			if PPC32
>   	select HAVE_SYSCALL_TRACEPOINTS
>   	select HAVE_VIRT_CPU_ACCOUNTING
> +	select HUGE_VMALLOC_DEFAULT_ENABLED	if HAVE_ARCH_HUGE_VMALLOC
>   	select HUGETLB_PAGE_SIZE_VARIABLE	if PPC_BOOK3S_64 && HUGETLB_PAGE
>   	select IOMMU_HELPER			if PPC64
>   	select IRQ_DOMAIN
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 356f4f2c779e..4ba91c0359bd 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -262,6 +262,13 @@ config HUGETLB_PAGE_SIZE_VARIABLE
>   	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
>   	  on a platform.
>   
> +config HUGE_VMALLOC_DEFAULT_ENABLED
> +	bool "Enable huge vmalloc mappings by default"
> +	depends on HAVE_ARCH_HUGE_VMALLOC
> +	help
> +	  Enable huge vmalloc mappings by default, this value could be overridden
> +	  by hugevmalloc=off|on.
> +
>   config CONTIG_ALLOC
>   	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
>   
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index d2a00ad4e1dd..3b6f99753816 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -58,7 +58,7 @@ static const unsigned int ioremap_max_page_shift = PAGE_SHIFT;
>   #endif	/* CONFIG_HAVE_ARCH_HUGE_VMAP */
>   
>   #ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC
> -static bool __ro_after_init vmap_allow_huge = true;
> +static bool __ro_after_init vmap_allow_huge = IS_ENABLED(CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED);
>   
>   static int __init set_nohugevmalloc(char *str)
>   {
> @@ -66,6 +66,22 @@ static int __init set_nohugevmalloc(char *str)
>   	return 0;
>   }
>   early_param("nohugevmalloc", set_nohugevmalloc);
> +
> +static int __init set_hugevmalloc(char *str)
> +{
> +	if (!str)
> +		return -EINVAL;
> +
> +	if (!strcmp(str, "on"))
> +		vmap_allow_huge = true;
> +	else if (!strcmp(str, "off"))
> +		vmap_allow_huge = true;
> +	else
> +		return -EINVAL;
> +
> +	return 0;
> +}
> +early_param("hugevmalloc=", set_hugevmalloc);
>   #else /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
>   static const bool vmap_allow_huge = false;
>   #endif	/* CONFIG_HAVE_ARCH_HUGE_VMALLOC */

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
@ 2021-12-26 17:36     ` Christophe Leroy
  0 siblings, 0 replies; 25+ messages in thread
From: Christophe Leroy @ 2021-12-26 17:36 UTC (permalink / raw)
  To: Kefeng Wang, Jonathan Corbet, Andrew Morton, linuxppc-dev,
	linux-doc, linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Catalin Marinas, Dave Hansen, Nicholas Piggin, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Paul Mackerras, Thomas Gleixner,
	Will Deacon



Le 26/12/2021 à 09:39, Kefeng Wang a écrit :
> Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
> not enable huge vmalloc mappings by default, and this could make
> more architectures to enable huge vmalloc mappings feature but
> don't want to enable it by default.
> 
> Add hugevmalloc=on/off parameter to enable or disable this feature
> at boot time, nohugevmalloc is still supported and equivalent to
> hugevmalloc=off.


Is there a real added value to have the user be able to select that ?

If the architecture supports it, is there any good reason to not use it ?

Why not just do like PPC and enable it by default ? Why should it be 
enabled by default on PPC but disabled by default on ARM64 and X86 ?


> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>   .../admin-guide/kernel-parameters.txt          | 12 ++++++++++++
>   arch/powerpc/Kconfig                           |  1 +
>   mm/Kconfig                                     |  7 +++++++
>   mm/vmalloc.c                                   | 18 +++++++++++++++++-
>   4 files changed, 37 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 2fba82431efb..4107136097a6 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1629,6 +1629,18 @@
>   			If both parameters are enabled, hugetlb_free_vmemmap takes
>   			precedence over memory_hotplug.memmap_on_memory.
>   
> +
> +	hugevmalloc=	[PPC] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC
> +			Format: { on | off }
> +			Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED.
> +
> +			This parameter enables/disables kernel huge vmalloc
> +			mappings at boot time.
> +
> +			on:  Enable the feature
> +			off: Disable the feature
> +			     Equivalent to: nohugevmalloc
> +
>   	hung_task_panic=
>   			[KNL] Should the hung task detector generate panics.
>   			Format: 0 | 1
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index dea74d7717c0..d59b221be264 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -246,6 +246,7 @@ config PPC
>   	select HAVE_STATIC_CALL			if PPC32
>   	select HAVE_SYSCALL_TRACEPOINTS
>   	select HAVE_VIRT_CPU_ACCOUNTING
> +	select HUGE_VMALLOC_DEFAULT_ENABLED	if HAVE_ARCH_HUGE_VMALLOC
>   	select HUGETLB_PAGE_SIZE_VARIABLE	if PPC_BOOK3S_64 && HUGETLB_PAGE
>   	select IOMMU_HELPER			if PPC64
>   	select IRQ_DOMAIN
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 356f4f2c779e..4ba91c0359bd 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -262,6 +262,13 @@ config HUGETLB_PAGE_SIZE_VARIABLE
>   	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
>   	  on a platform.
>   
> +config HUGE_VMALLOC_DEFAULT_ENABLED
> +	bool "Enable huge vmalloc mappings by default"
> +	depends on HAVE_ARCH_HUGE_VMALLOC
> +	help
> +	  Enable huge vmalloc mappings by default, this value could be overridden
> +	  by hugevmalloc=off|on.
> +
>   config CONTIG_ALLOC
>   	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
>   
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index d2a00ad4e1dd..3b6f99753816 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -58,7 +58,7 @@ static const unsigned int ioremap_max_page_shift = PAGE_SHIFT;
>   #endif	/* CONFIG_HAVE_ARCH_HUGE_VMAP */
>   
>   #ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC
> -static bool __ro_after_init vmap_allow_huge = true;
> +static bool __ro_after_init vmap_allow_huge = IS_ENABLED(CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED);
>   
>   static int __init set_nohugevmalloc(char *str)
>   {
> @@ -66,6 +66,22 @@ static int __init set_nohugevmalloc(char *str)
>   	return 0;
>   }
>   early_param("nohugevmalloc", set_nohugevmalloc);
> +
> +static int __init set_hugevmalloc(char *str)
> +{
> +	if (!str)
> +		return -EINVAL;
> +
> +	if (!strcmp(str, "on"))
> +		vmap_allow_huge = true;
> +	else if (!strcmp(str, "off"))
> +		vmap_allow_huge = true;
> +	else
> +		return -EINVAL;
> +
> +	return 0;
> +}
> +early_param("hugevmalloc=", set_hugevmalloc);
>   #else /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
>   static const bool vmap_allow_huge = false;
>   #endif	/* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
  2021-12-26 17:36     ` Christophe Leroy
@ 2021-12-27  1:44       ` Kefeng Wang
  -1 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-27  1:44 UTC (permalink / raw)
  To: Christophe Leroy, Jonathan Corbet, Andrew Morton, linuxppc-dev,
	linux-doc, linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Catalin Marinas, Dave Hansen, Nicholas Piggin, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Paul Mackerras, Thomas Gleixner,
	Will Deacon


On 2021/12/27 1:36, Christophe Leroy wrote:
>
> Le 26/12/2021 à 09:39, Kefeng Wang a écrit :
>> Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
>> not enable huge vmalloc mappings by default, and this could make
>> more architectures to enable huge vmalloc mappings feature but
>> don't want to enable it by default.
>>
>> Add hugevmalloc=on/off parameter to enable or disable this feature
>> at boot time, nohugevmalloc is still supported and equivalent to
>> hugevmalloc=off.
>
> Is there a real added value to have the user be able to select that ?
>
> If the architecture supports it, is there any good reason to not use it ?

There are some disadvantages[1],  one of the main concerns is the possible

memory waste, we have backported this feature to our kernel 5.10, but our

downstream in our some scenario(especially in embedded), they don't want

it enabled by default, and others want it, this is why patch1 comes.

>
> Why not just do like PPC and enable it by default ? Why should it be
> enabled by default on PPC but disabled by default on ARM64 and X86 ?

The PPC is default enabled, we don't changes this behavior.

Maybe upstream is not care about this, as I said in cover-letter, if 
arm64/x86

don't want patch1, we could only just select config to enable it.

Let's wait for more feedback.

Thanks.

[1] 
https://lore.kernel.org/linux-mm/1616036421.amjz2efujj.astroid@bobo.none/


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
@ 2021-12-27  1:44       ` Kefeng Wang
  0 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-27  1:44 UTC (permalink / raw)
  To: Christophe Leroy, Jonathan Corbet, Andrew Morton, linuxppc-dev,
	linux-doc, linux-kernel, linux-mm, x86, linux-arm-kernel
  Cc: Catalin Marinas, Dave Hansen, Nicholas Piggin, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Paul Mackerras, Thomas Gleixner,
	Will Deacon


On 2021/12/27 1:36, Christophe Leroy wrote:
>
> Le 26/12/2021 à 09:39, Kefeng Wang a écrit :
>> Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
>> not enable huge vmalloc mappings by default, and this could make
>> more architectures to enable huge vmalloc mappings feature but
>> don't want to enable it by default.
>>
>> Add hugevmalloc=on/off parameter to enable or disable this feature
>> at boot time, nohugevmalloc is still supported and equivalent to
>> hugevmalloc=off.
>
> Is there a real added value to have the user be able to select that ?
>
> If the architecture supports it, is there any good reason to not use it ?

There are some disadvantages[1],  one of the main concerns is the possible

memory waste, we have backported this feature to our kernel 5.10, but our

downstream in our some scenario(especially in embedded), they don't want

it enabled by default, and others want it, this is why patch1 comes.

>
> Why not just do like PPC and enable it by default ? Why should it be
> enabled by default on PPC but disabled by default on ARM64 and X86 ?

The PPC is default enabled, we don't changes this behavior.

Maybe upstream is not care about this, as I said in cover-letter, if 
arm64/x86

don't want patch1, we could only just select config to enable it.

Let's wait for more feedback.

Thanks.

[1] 
https://lore.kernel.org/linux-mm/1616036421.amjz2efujj.astroid@bobo.none/


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
  2021-12-27  1:44       ` Kefeng Wang
  (?)
@ 2021-12-27  3:19         ` Matthew Wilcox
  -1 siblings, 0 replies; 25+ messages in thread
From: Matthew Wilcox @ 2021-12-27  3:19 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: Christophe Leroy, Jonathan Corbet, Andrew Morton, linuxppc-dev,
	linux-doc, linux-kernel, linux-mm, x86, linux-arm-kernel,
	Catalin Marinas, Dave Hansen, Nicholas Piggin, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Paul Mackerras, Thomas Gleixner,
	Will Deacon

On Mon, Dec 27, 2021 at 09:44:24AM +0800, Kefeng Wang wrote:
> 
> On 2021/12/27 1:36, Christophe Leroy wrote:
> > 
> > Le 26/12/2021 à 09:39, Kefeng Wang a écrit :
> > > Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
> > > not enable huge vmalloc mappings by default, and this could make
> > > more architectures to enable huge vmalloc mappings feature but
> > > don't want to enable it by default.
> > > 
> > > Add hugevmalloc=on/off parameter to enable or disable this feature
> > > at boot time, nohugevmalloc is still supported and equivalent to
> > > hugevmalloc=off.
> > 
> > Is there a real added value to have the user be able to select that ?
> > 
> > If the architecture supports it, is there any good reason to not use it ?
> 
> There are some disadvantages[1],  one of the main concerns is the possible
> 
> memory waste, we have backported this feature to our kernel 5.10, but our
> 
> downstream in our some scenario(especially in embedded), they don't want
> 
> it enabled by default, and others want it, this is why patch1 comes.
> 
> > 
> > Why not just do like PPC and enable it by default ? Why should it be
> > enabled by default on PPC but disabled by default on ARM64 and X86 ?
> 
> The PPC is default enabled, we don't changes this behavior.
> 
> Maybe upstream is not care about this, as I said in cover-letter, if
> arm64/x86
> 
> don't want patch1, we could only just select config to enable it.
> 
> Let's wait for more feedback.

We should not have different defaults by architecture.  Either we change
the default for PPC, or x86 & arm should have the same default as PPC.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
@ 2021-12-27  3:19         ` Matthew Wilcox
  0 siblings, 0 replies; 25+ messages in thread
From: Matthew Wilcox @ 2021-12-27  3:19 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: x86, Paul Mackerras, linux-doc, Catalin Marinas, Jonathan Corbet,
	linux-kernel, linux-mm, Will Deacon, Ingo Molnar, Dave Hansen,
	Nicholas Piggin, H. Peter Anvin, Borislav Petkov, Andrew Morton,
	linuxppc-dev, Thomas Gleixner, linux-arm-kernel

On Mon, Dec 27, 2021 at 09:44:24AM +0800, Kefeng Wang wrote:
> 
> On 2021/12/27 1:36, Christophe Leroy wrote:
> > 
> > Le 26/12/2021 à 09:39, Kefeng Wang a écrit :
> > > Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
> > > not enable huge vmalloc mappings by default, and this could make
> > > more architectures to enable huge vmalloc mappings feature but
> > > don't want to enable it by default.
> > > 
> > > Add hugevmalloc=on/off parameter to enable or disable this feature
> > > at boot time, nohugevmalloc is still supported and equivalent to
> > > hugevmalloc=off.
> > 
> > Is there a real added value to have the user be able to select that ?
> > 
> > If the architecture supports it, is there any good reason to not use it ?
> 
> There are some disadvantages[1],  one of the main concerns is the possible
> 
> memory waste, we have backported this feature to our kernel 5.10, but our
> 
> downstream in our some scenario(especially in embedded), they don't want
> 
> it enabled by default, and others want it, this is why patch1 comes.
> 
> > 
> > Why not just do like PPC and enable it by default ? Why should it be
> > enabled by default on PPC but disabled by default on ARM64 and X86 ?
> 
> The PPC is default enabled, we don't changes this behavior.
> 
> Maybe upstream is not care about this, as I said in cover-letter, if
> arm64/x86
> 
> don't want patch1, we could only just select config to enable it.
> 
> Let's wait for more feedback.

We should not have different defaults by architecture.  Either we change
the default for PPC, or x86 & arm should have the same default as PPC.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
@ 2021-12-27  3:19         ` Matthew Wilcox
  0 siblings, 0 replies; 25+ messages in thread
From: Matthew Wilcox @ 2021-12-27  3:19 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: Christophe Leroy, Jonathan Corbet, Andrew Morton, linuxppc-dev,
	linux-doc, linux-kernel, linux-mm, x86, linux-arm-kernel,
	Catalin Marinas, Dave Hansen, Nicholas Piggin, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Paul Mackerras, Thomas Gleixner,
	Will Deacon

On Mon, Dec 27, 2021 at 09:44:24AM +0800, Kefeng Wang wrote:
> 
> On 2021/12/27 1:36, Christophe Leroy wrote:
> > 
> > Le 26/12/2021 à 09:39, Kefeng Wang a écrit :
> > > Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
> > > not enable huge vmalloc mappings by default, and this could make
> > > more architectures to enable huge vmalloc mappings feature but
> > > don't want to enable it by default.
> > > 
> > > Add hugevmalloc=on/off parameter to enable or disable this feature
> > > at boot time, nohugevmalloc is still supported and equivalent to
> > > hugevmalloc=off.
> > 
> > Is there a real added value to have the user be able to select that ?
> > 
> > If the architecture supports it, is there any good reason to not use it ?
> 
> There are some disadvantages[1],  one of the main concerns is the possible
> 
> memory waste, we have backported this feature to our kernel 5.10, but our
> 
> downstream in our some scenario(especially in embedded), they don't want
> 
> it enabled by default, and others want it, this is why patch1 comes.
> 
> > 
> > Why not just do like PPC and enable it by default ? Why should it be
> > enabled by default on PPC but disabled by default on ARM64 and X86 ?
> 
> The PPC is default enabled, we don't changes this behavior.
> 
> Maybe upstream is not care about this, as I said in cover-letter, if
> arm64/x86
> 
> don't want patch1, we could only just select config to enable it.
> 
> Let's wait for more feedback.

We should not have different defaults by architecture.  Either we change
the default for PPC, or x86 & arm should have the same default as PPC.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
  2021-12-27  3:19         ` Matthew Wilcox
  (?)
@ 2021-12-27  6:14           ` Kefeng Wang
  -1 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-27  6:14 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Christophe Leroy, Jonathan Corbet, Andrew Morton, linuxppc-dev,
	linux-doc, linux-kernel, linux-mm, x86, linux-arm-kernel,
	Catalin Marinas, Dave Hansen, Nicholas Piggin, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Paul Mackerras, Thomas Gleixner,
	Will Deacon


On 2021/12/27 11:19, Matthew Wilcox wrote:
> On Mon, Dec 27, 2021 at 09:44:24AM +0800, Kefeng Wang wrote:
>> On 2021/12/27 1:36, Christophe Leroy wrote:
>>> Le 26/12/2021 à 09:39, Kefeng Wang a écrit :
>>>> Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
>>>> not enable huge vmalloc mappings by default, and this could make
>>>> more architectures to enable huge vmalloc mappings feature but
>>>> don't want to enable it by default.
>>>>
>>>> Add hugevmalloc=on/off parameter to enable or disable this feature
>>>> at boot time, nohugevmalloc is still supported and equivalent to
>>>> hugevmalloc=off.
>>> Is there a real added value to have the user be able to select that ?
>>>
>>> If the architecture supports it, is there any good reason to not use it ?
>> There are some disadvantages[1],  one of the main concerns is the possible
>>
>> memory waste, we have backported this feature to our kernel 5.10, but our
>>
>> downstream in our some scenario(especially in embedded), they don't want
>>
>> it enabled by default, and others want it, this is why patch1 comes.
>>
>>> Why not just do like PPC and enable it by default ? Why should it be
>>> enabled by default on PPC but disabled by default on ARM64 and X86 ?
>> The PPC is default enabled, we don't changes this behavior.
>>
>> Maybe upstream is not care about this, as I said in cover-letter, if
>> arm64/x86
>>
>> don't want patch1, we could only just select config to enable it.
>>
>> Let's wait for more feedback.
> We should not have different defaults by architecture.  Either we change
> the default for PPC, or x86 & arm should have the same default as PPC.

Ok, since HUGE_VMALLOC_DEFAULT_ENABLED is introduced, we could make it

default y, not only select it on PPC, then the ppc/arm64/x86 have same 
default value.

And if someone don't want it, they could not enable this config.

Meanwhile hugevmalloc=on/off to make this feature to enable/disable at 
boot time.

I will add some explanation and resend it, thanks.

> .

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
@ 2021-12-27  6:14           ` Kefeng Wang
  0 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-27  6:14 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: x86, Paul Mackerras, linux-doc, Catalin Marinas, Jonathan Corbet,
	linux-kernel, linux-mm, Will Deacon, Ingo Molnar, Dave Hansen,
	Nicholas Piggin, H. Peter Anvin, Borislav Petkov, Andrew Morton,
	linuxppc-dev, Thomas Gleixner, linux-arm-kernel


On 2021/12/27 11:19, Matthew Wilcox wrote:
> On Mon, Dec 27, 2021 at 09:44:24AM +0800, Kefeng Wang wrote:
>> On 2021/12/27 1:36, Christophe Leroy wrote:
>>> Le 26/12/2021 à 09:39, Kefeng Wang a écrit :
>>>> Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
>>>> not enable huge vmalloc mappings by default, and this could make
>>>> more architectures to enable huge vmalloc mappings feature but
>>>> don't want to enable it by default.
>>>>
>>>> Add hugevmalloc=on/off parameter to enable or disable this feature
>>>> at boot time, nohugevmalloc is still supported and equivalent to
>>>> hugevmalloc=off.
>>> Is there a real added value to have the user be able to select that ?
>>>
>>> If the architecture supports it, is there any good reason to not use it ?
>> There are some disadvantages[1],  one of the main concerns is the possible
>>
>> memory waste, we have backported this feature to our kernel 5.10, but our
>>
>> downstream in our some scenario(especially in embedded), they don't want
>>
>> it enabled by default, and others want it, this is why patch1 comes.
>>
>>> Why not just do like PPC and enable it by default ? Why should it be
>>> enabled by default on PPC but disabled by default on ARM64 and X86 ?
>> The PPC is default enabled, we don't changes this behavior.
>>
>> Maybe upstream is not care about this, as I said in cover-letter, if
>> arm64/x86
>>
>> don't want patch1, we could only just select config to enable it.
>>
>> Let's wait for more feedback.
> We should not have different defaults by architecture.  Either we change
> the default for PPC, or x86 & arm should have the same default as PPC.

Ok, since HUGE_VMALLOC_DEFAULT_ENABLED is introduced, we could make it

default y, not only select it on PPC, then the ppc/arm64/x86 have same 
default value.

And if someone don't want it, they could not enable this config.

Meanwhile hugevmalloc=on/off to make this feature to enable/disable at 
boot time.

I will add some explanation and resend it, thanks.

> .

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior
@ 2021-12-27  6:14           ` Kefeng Wang
  0 siblings, 0 replies; 25+ messages in thread
From: Kefeng Wang @ 2021-12-27  6:14 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Christophe Leroy, Jonathan Corbet, Andrew Morton, linuxppc-dev,
	linux-doc, linux-kernel, linux-mm, x86, linux-arm-kernel,
	Catalin Marinas, Dave Hansen, Nicholas Piggin, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Paul Mackerras, Thomas Gleixner,
	Will Deacon


On 2021/12/27 11:19, Matthew Wilcox wrote:
> On Mon, Dec 27, 2021 at 09:44:24AM +0800, Kefeng Wang wrote:
>> On 2021/12/27 1:36, Christophe Leroy wrote:
>>> Le 26/12/2021 à 09:39, Kefeng Wang a écrit :
>>>> Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or
>>>> not enable huge vmalloc mappings by default, and this could make
>>>> more architectures to enable huge vmalloc mappings feature but
>>>> don't want to enable it by default.
>>>>
>>>> Add hugevmalloc=on/off parameter to enable or disable this feature
>>>> at boot time, nohugevmalloc is still supported and equivalent to
>>>> hugevmalloc=off.
>>> Is there a real added value to have the user be able to select that ?
>>>
>>> If the architecture supports it, is there any good reason to not use it ?
>> There are some disadvantages[1],  one of the main concerns is the possible
>>
>> memory waste, we have backported this feature to our kernel 5.10, but our
>>
>> downstream in our some scenario(especially in embedded), they don't want
>>
>> it enabled by default, and others want it, this is why patch1 comes.
>>
>>> Why not just do like PPC and enable it by default ? Why should it be
>>> enabled by default on PPC but disabled by default on ARM64 and X86 ?
>> The PPC is default enabled, we don't changes this behavior.
>>
>> Maybe upstream is not care about this, as I said in cover-letter, if
>> arm64/x86
>>
>> don't want patch1, we could only just select config to enable it.
>>
>> Let's wait for more feedback.
> We should not have different defaults by architecture.  Either we change
> the default for PPC, or x86 & arm should have the same default as PPC.

Ok, since HUGE_VMALLOC_DEFAULT_ENABLED is introduced, we could make it

default y, not only select it on PPC, then the ppc/arm64/x86 have same 
default value.

And if someone don't want it, they could not enable this config.

Meanwhile hugevmalloc=on/off to make this feature to enable/disable at 
boot time.

I will add some explanation and resend it, thanks.

> .

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2021-12-27  6:16 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-26  8:39 [PATCH 0/3] mm: support huge vmalloc mapping on arm64/x86 Kefeng Wang
2021-12-26  8:39 ` Kefeng Wang
2021-12-26  8:39 ` Kefeng Wang
2021-12-26  8:39 ` [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior Kefeng Wang
2021-12-26  8:39   ` Kefeng Wang
2021-12-26  8:39   ` Kefeng Wang
2021-12-26  8:33   ` Kefeng Wang
2021-12-26  8:33     ` Kefeng Wang
2021-12-26  8:33     ` Kefeng Wang
2021-12-26 17:36   ` Christophe Leroy
2021-12-26 17:36     ` Christophe Leroy
2021-12-27  1:44     ` Kefeng Wang
2021-12-27  1:44       ` Kefeng Wang
2021-12-27  3:19       ` Matthew Wilcox
2021-12-27  3:19         ` Matthew Wilcox
2021-12-27  3:19         ` Matthew Wilcox
2021-12-27  6:14         ` Kefeng Wang
2021-12-27  6:14           ` Kefeng Wang
2021-12-27  6:14           ` Kefeng Wang
2021-12-26  8:39 ` [PATCH 2/3] arm64: Support huge vmalloc mappings Kefeng Wang
2021-12-26  8:39   ` Kefeng Wang
2021-12-26  8:39   ` Kefeng Wang
2021-12-26  8:39 ` [PATCH 3/3] x86: " Kefeng Wang
2021-12-26  8:39   ` Kefeng Wang
2021-12-26  8:39   ` Kefeng Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.