提交 2a366009 编写于 作者: K Kefeng Wang 提交者: Zheng Zengkai

mm: vmalloc: Let user to control huge vmalloc default behavior

maillist inclusion
category: Feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4NDAW
CVE: NA

Reference: https://lore.kernel.org/lkml/20211226083912.166512-4-wangkefeng.wang@huawei.com/t/

-------------------

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: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NWang Wensheng <wangwensheng4@huawei.com>
Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 c649babf
...@@ -1587,6 +1587,17 @@ ...@@ -1587,6 +1587,17 @@
on: enable the feature on: enable the feature
off: disable the feature off: disable the feature
hugevmalloc [PPC] Requires 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= hung_task_panic=
[KNL] Should the hung task detector generate panics. [KNL] Should the hung task detector generate panics.
Format: 0 | 1 Format: 0 | 1
......
...@@ -180,6 +180,7 @@ config PPC ...@@ -180,6 +180,7 @@ config PPC
select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_HUGE_VMAP if PPC_BOOK3S_64 && PPC_RADIX_MMU select HAVE_ARCH_HUGE_VMAP if PPC_BOOK3S_64 && PPC_RADIX_MMU
select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
select HUGE_VMALLOC_DEFAULT_ENABLED if HAVE_ARCH_HUGE_VMALLOC
select HAVE_ARCH_JUMP_LABEL select HAVE_ARCH_JUMP_LABEL
select HAVE_ARCH_KASAN if PPC32 && PPC_PAGE_SHIFT <= 14 select HAVE_ARCH_KASAN if PPC32 && PPC_PAGE_SHIFT <= 14
select HAVE_ARCH_KASAN_VMALLOC if PPC32 && PPC_PAGE_SHIFT <= 14 select HAVE_ARCH_KASAN_VMALLOC if PPC32 && PPC_PAGE_SHIFT <= 14
......
...@@ -284,6 +284,13 @@ config ARCH_ENABLE_HUGEPAGE_MIGRATION ...@@ -284,6 +284,13 @@ config ARCH_ENABLE_HUGEPAGE_MIGRATION
config ARCH_ENABLE_THP_MIGRATION config ARCH_ENABLE_THP_MIGRATION
bool bool
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 config CONTIG_ALLOC
def_bool (MEMORY_ISOLATION && COMPACTION) || CMA def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include "pgalloc-track.h" #include "pgalloc-track.h"
#ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC #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) static int __init set_nohugevmalloc(char *str)
{ {
...@@ -51,6 +51,22 @@ static int __init set_nohugevmalloc(char *str) ...@@ -51,6 +51,22 @@ static int __init set_nohugevmalloc(char *str)
return 0; return 0;
} }
early_param("nohugevmalloc", set_nohugevmalloc); 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 = false;
else
return -EINVAL;
return 0;
}
early_param("hugevmalloc", set_hugevmalloc);
#else /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */ #else /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
static const bool vmap_allow_huge = false; static const bool vmap_allow_huge = false;
#endif /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */ #endif /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册