Commit f2515d31 authored by Chen Wandun's avatar Chen Wandun Committed by Zheng Zengkai
Browse files

Revert "mm/page_cache_limit: calculate reclaim pages for each node"

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4HOXK


CVE: NA

--------------------------------

This reverts commit 425bce98.
This feature will be reimplement.

Signed-off-by: default avatarChen Wandun <chenwandun@huawei.com>
Reviewed-by: default avatarTong Tiangen <tongtiangen@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 09d07df0
Loading
Loading
Loading
Loading
+1 −51
Original line number Diff line number Diff line
@@ -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);