From a08e20093f374665986fb25d04673f37a0cee60c Mon Sep 17 00:00:00 2001 From: Chen Wandun Date: Wed, 9 Feb 2022 15:36:38 +0800 Subject: [PATCH] sysctl: add proc interface to set page cache limit hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4SK3S CVE: NA -------------------------------- Add two proc interfaces to set page cache limit. Both vm_cache_limit_mbytes and vm_cache_limit_ratio will be update when writing either of the two interfaces. Signed-off-by: Chen Wandun Reviewed-by: Kefeng Wang Signed-off-by: Yang Yingliang --- kernel/sysctl.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 31c35a65fbb7..542611081c61 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1468,6 +1468,24 @@ static struct ctl_table vm_table[] = { .extra1 = &zero, .extra2 = &one, }, + { + .procname = "cache_limit_mbytes", + .data = &vm_cache_limit_mbytes, + .maxlen = sizeof(vm_cache_limit_mbytes), + .mode = 0644, + .proc_handler = cache_limit_mbytes_sysctl_handler, + .extra1 = &vm_cache_limit_mbytes_min, + .extra2 = &vm_cache_limit_mbytes_max, + }, + { + .procname = "cache_limit_ratio", + .data = &vm_cache_limit_ratio, + .maxlen = sizeof(vm_cache_limit_ratio), + .mode = 0644, + .proc_handler = cache_limit_ratio_sysctl_handler, + .extra1 = &vm_cache_limit_ratio_min, + .extra2 = &vm_cache_limit_ratio_max, + }, #endif #ifdef CONFIG_HUGETLB_PAGE { -- GitLab