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 425bce986237e0409673c28774bbe546b433dee7.
Signed-off-by: Chen Wandun chenwandun@huawei.com Reviewed-by: Tong Tiangen tongtiangen@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- mm/page_cache_limit.c | 52 +------------------------------------------ 1 file changed, 1 insertion(+), 51 deletions(-)
diff --git a/mm/page_cache_limit.c b/mm/page_cache_limit.c index 33164e19cfa2..4afc08373a35 100644 --- a/mm/page_cache_limit.c +++ b/mm/page_cache_limit.c @@ -104,60 +104,10 @@ void wakeup_all_kpagecache_limitd(void) wakeup_kpagecache_limitd(nid); }
-static unsigned long node_nr_page_cache(int nid) -{ - struct pglist_data *pgdat; - unsigned long num = 0; - - pgdat = NODE_DATA(nid); - if (!pgdat) - return 0; - - num = node_page_state(pgdat, NR_FILE_PAGES); - num -= node_page_state(pgdat, NR_SHMEM); - - return num; -} - -static unsigned long node_nr_page_reclaim(int nid) -{ - unsigned long nr_page_cache; - unsigned long nr_to_reclaim; - unsigned long total_pages; - - if (!node_pagecache_limit_pages[nid]) - return 0; - - nr_page_cache = node_nr_page_cache(nid); - if (!nr_page_cache) - return 0; - - if (nr_page_cache < node_pagecache_limit_pages[nid]) - return 0; - - total_pages = get_node_total_pages(nid); - nr_to_reclaim = nr_page_cache - node_pagecache_limit_pages[nid]; - nr_to_reclaim += total_pages * pagecache_reclaim_ratio / 100; - - return nr_to_reclaim; -} - -static void shrink_node_page_cache(int nid) -{ - unsigned long nr_to_reclaim; - - nr_to_reclaim = node_nr_page_reclaim(nid); -} - static void shrink_page_cache(void) { - int nid; - - if (!pagecache_reclaim_enable || !pagecache_overlimit()) + if (!pagecache_overlimit()) return; - - for_each_node_state(nid, N_MEMORY) - shrink_node_page_cache(nid); }
static DECLARE_COMPLETION(setup_done);