
From: Yu Liao <liaoyu15@huawei.com> hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4XB9H CVE: NA -------------------------------- CONFIG_CLEAR_FREELIST_PAGE specifies the default value for clear freelist. Add a kernel parameter to make it possible to override the default. Keep clear_freelist disabled unless "clear_freelist" is explicitly specified. Signed-off-by: Yu Liao <liaoyu15@huawei.com> Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Laibin Qiu <qiulaibin@huawei.com> --- Documentation/admin-guide/kernel-parameters.txt | 4 ++++ mm/clear_freelist_page.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index a46b2fe191ba..2cb6c844d751 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -516,6 +516,10 @@ cio_ignore= [S390] See Documentation/s390/CommonIO for details. + + clear_freelist + Enable clear_freelist feature. + clk_ignore_unused [CLK] Prevents the clock framework from automatically gating diff --git a/mm/clear_freelist_page.c b/mm/clear_freelist_page.c index 69975f458dc7..f0a13b8fdcdb 100644 --- a/mm/clear_freelist_page.c +++ b/mm/clear_freelist_page.c @@ -154,9 +154,18 @@ static struct ctl_table sys_ctl_table[] = { { } }; +static bool clear_freelist_enabled; +static int __init setup_clear_freelist(char *str) +{ + clear_freelist_enabled = true; + return 1; +} +__setup("clear_freelist", setup_clear_freelist); + static int __init clear_freelist_init(void) { - register_sysctl_table(sys_ctl_table); + if (clear_freelist_enabled) + register_sysctl_table(sys_ctl_table); return 0; } -- 2.22.0