From: Chen Wandun chenwandun@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4HOXK CVE: NA
--------------------------------
This reverts commit 933db18abca2a5d0a2eaa2fc40a85c2d88cf896a. This feature will be reimplement.
Signed-off-by: Chen Wandun chenwandun@huawei.com Reviewed-by: Tong Tiangen tongtiangen@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/page_cache_limit.h | 14 --------- kernel/sysctl.c | 32 -------------------- mm/Kconfig | 12 -------- mm/Makefile | 1 - mm/page_cache_limit.c | 51 -------------------------------- 5 files changed, 110 deletions(-) delete mode 100644 include/linux/page_cache_limit.h delete mode 100644 mm/page_cache_limit.c
diff --git a/include/linux/page_cache_limit.h b/include/linux/page_cache_limit.h deleted file mode 100644 index 98f12734114b..000000000000 --- a/include/linux/page_cache_limit.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _PAGECACHE_H -#define _PAGECACHE_H - -#ifdef CONFIG_SHRINK_PAGECACHE -extern int pagecache_reclaim_enable; -extern int pagecache_limit_ratio; -extern int pagecache_reclaim_ratio; - -int proc_page_cache_limit(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos); -#else -#endif - -#endif diff --git a/kernel/sysctl.c b/kernel/sysctl.c index e26bda90e8b0..c1eebbcd0a1c 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -104,9 +104,6 @@ #ifdef CONFIG_LOCKUP_DETECTOR #include <linux/nmi.h> #endif -#ifdef CONFIG_SHRINK_PAGECACHE -#include <linux/page_cache_limit.h> -#endif
#if defined(CONFIG_SYSCTL)
@@ -3212,35 +3209,6 @@ static struct ctl_table vm_table[] = { .extra2 = SYSCTL_ONE, }, #endif -#ifdef CONFIG_SHRINK_PAGECACHE - { - .procname = "cache_reclaim_enable", - .data = &pagecache_reclaim_enable, - .maxlen = sizeof(pagecache_reclaim_enable), - .mode = 0600, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - .extra2 = SYSCTL_ONE, - }, - { - .procname = "cache_limit_ratio", - .data = &pagecache_limit_ratio, - .maxlen = sizeof(pagecache_limit_ratio), - .mode = 0600, - .proc_handler = proc_page_cache_limit, - .extra1 = SYSCTL_ZERO, - .extra2 = (void *)&one_hundred, - }, - { - .procname = "cache_reclaim_ratio", - .data = &pagecache_reclaim_ratio, - .maxlen = sizeof(pagecache_reclaim_ratio), - .mode = 0600, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - .extra2 = (void *)&one_hundred, - }, -#endif #ifdef CONFIG_ASCEND_SHARE_POOL { .procname = "sharepool_debug_mode", diff --git a/mm/Kconfig b/mm/Kconfig index 4475bd9f8762..9e66dfb15c52 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -500,18 +500,6 @@ config FRONTSWAP
If unsure, say Y to enable frontswap.
-config SHRINK_PAGECACHE - bool "Enable shrinking the page cache" - depends on MMU - default n - help - SHRINK_PAGECACHE means that we do not want to keep the large number - of page cache in the system, even though page cache can greatly improve - the performance of the machine. Large number of page cache may result - in short of memory, which will result OOM at the same time, so in order - to keep page cache in a reasonable range, the number of page cache - should be limited, and that is what SHRINK_PAGECACHE does. - config MEMCG_QOS bool "Enable Memory Cgroup Priority" depends on MEMCG diff --git a/mm/Makefile b/mm/Makefile index e83233177c7a..7465668c4b02 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -126,7 +126,6 @@ obj-$(CONFIG_PTDUMP_CORE) += ptdump.o obj-$(CONFIG_PAGE_REPORTING) += page_reporting.o obj-$(CONFIG_HAVE_BOOTMEM_INFO_NODE) += bootmem_info.o obj-$(CONFIG_PIN_MEMORY) += pin_mem.o -obj-$(CONFIG_SHRINK_PAGECACHE) += page_cache_limit.o obj-$(CONFIG_ASCEND_SHARE_POOL) += share_pool.o obj-$(CONFIG_MEMORY_RELIABLE) += mem_reliable.o obj-$(CONFIG_MEMCG_MEMFS_INFO) += memcg_memfs_info.o diff --git a/mm/page_cache_limit.c b/mm/page_cache_limit.c deleted file mode 100644 index 55fdea087804..000000000000 --- a/mm/page_cache_limit.c +++ /dev/null @@ -1,51 +0,0 @@ -#include <linux/mm.h> -#include <linux/sysctl.h> - -int pagecache_reclaim_enable; -int pagecache_limit_ratio; -int pagecache_reclaim_ratio; - -static unsigned long pagecache_limit_pages; -static unsigned long node_pagecache_limit_pages[MAX_NUMNODES]; - -static unsigned long get_node_total_pages(int nid) -{ - int zone_type; - unsigned long managed_pages = 0; - pg_data_t *pgdat = NODE_DATA(nid); - - if (!pgdat) - return 0; - - for (zone_type = 0; zone_type < MAX_NR_ZONES; zone_type++) - managed_pages += zone_managed_pages(&pgdat->node_zones[zone_type]); - - return managed_pages; -} - -static void setup_pagecache_limit(void) -{ - int i; - unsigned long node_total_pages; - - pagecache_limit_pages = pagecache_limit_ratio * totalram_pages() / 100; - - for (i = 0; i < MAX_NUMNODES; i++) { - node_total_pages = get_node_total_pages(i); - node_pagecache_limit_pages[i] = node_total_pages * - pagecache_limit_ratio / 100; - } -} - -int proc_page_cache_limit(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - int ret; - - ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); - - if (write && !ret) - setup_pagecache_limit(); - - return ret; -}