From: Chen Wandun chenwandun@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I56I4P CVE: NA backport: openEuler-22.03-LTS
--------------------------------
This reverts commit 955d63aec936df0ffbb53118ab28b4c208ac8abf.
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 | 4 --- mm/memory_hotplug.c | 3 --- mm/page_cache_limit.c | 45 +++++++------------------------- 3 files changed, 9 insertions(+), 43 deletions(-)
diff --git a/include/linux/page_cache_limit.h b/include/linux/page_cache_limit.h index 7906b12af947..e4ef5919cb92 100644 --- a/include/linux/page_cache_limit.h +++ b/include/linux/page_cache_limit.h @@ -17,11 +17,7 @@ int proc_page_cache_limit(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos); unsigned long __shrink_node_page_cache(int nid, gfp_t mask, unsigned long nr_to_reclaim, enum page_cache_reclaim_flag flag); -void kpagecache_limitd_stop(int nid); -int kpagecache_limitd_run(int nid); #else -static inline void kpagecache_limitd_stop(int nid) {} -static inline int kpagecache_limitd_run(int nid) { return 0; } #endif
#endif diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 73ea92dae74a..7456d825414d 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -38,7 +38,6 @@ #include <linux/rmap.h>
#include <asm/tlbflush.h> -#include <linux/page_cache_limit.h>
#include "internal.h" #include "shuffle.h" @@ -736,7 +735,6 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages,
kswapd_run(nid); kcompactd_run(nid); - kpagecache_limitd_run(nid);
writeback_set_ratelimit();
@@ -1487,7 +1485,6 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages) if (arg.status_change_nid >= 0) { kswapd_stop(node); kcompactd_stop(node); - kpagecache_limitd_stop(node); }
writeback_set_ratelimit(); diff --git a/mm/page_cache_limit.c b/mm/page_cache_limit.c index 0a3098c9bb33..1581334429e1 100644 --- a/mm/page_cache_limit.c +++ b/mm/page_cache_limit.c @@ -31,27 +31,18 @@ static unsigned long get_node_total_pages(int nid) return managed_pages; }
-static void setup_node_pagecache_limit(int nid) -{ - unsigned long node_total_pages; - - node_total_pages = get_node_total_pages(nid); - node_pagecache_limit_pages[nid] = node_total_pages * pagecache_limit_ratio / 100; -} - -#define ALL_NODE (-1) -static void setup_pagecache_limit(int nid) +static void setup_pagecache_limit(void) { int i; + unsigned long node_total_pages;
pagecache_limit_pages = pagecache_limit_ratio * totalram_pages() / 100;
- if (nid != ALL_NODE) - setup_node_pagecache_limit(nid); - - else - for (i = 0; i < MAX_NUMNODES; i++) - setup_node_pagecache_limit(i); + 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, @@ -62,7 +53,7 @@ int proc_page_cache_limit(struct ctl_table *table, int write, ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
if (write && !ret) - setup_pagecache_limit(ALL_NODE); + setup_pagecache_limit();
return ret; } @@ -81,8 +72,6 @@ void kpagecache_limitd_stop(int nid) kvfree(pagecache_limitd_wait_queue[nid]); pagecache_limitd_wait_queue[nid] = NULL; } - - setup_pagecache_limit(nid); }
static void wakeup_kpagecache_limitd(int nid) @@ -218,7 +207,7 @@ static int pagecache_limitd(void *arg) return 0; }
-static int __kpagecache_limitd_run(int nid) +int kpagecache_limitd_run(int nid) { int ret = 0; wait_queue_head_t *queue_head = NULL; @@ -247,22 +236,6 @@ static int __kpagecache_limitd_run(int nid) return ret; }
-int kpagecache_limitd_run(int nid) -{ - int ret; - - if (nid < 0 || nid >= MAX_NUMNODES) - return -EINVAL; - - ret = __kpagecache_limitd_run(nid); - if (ret) - return ret; - - setup_pagecache_limit(nid); - - return 0; -} - static int __init kpagecache_limitd_init(void) { int nid;