提交 09d07df0 编写于 作者: C Chen Wandun 提交者: Zheng Zengkai

Revert "mm/page_cache_limit: shrink page cache"

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

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

This reverts commit 7be2f4c4.
This feature will be reimplement.
Signed-off-by: NChen Wandun <chenwandun@huawei.com>
Reviewed-by: NTong Tiangen <tongtiangen@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 2d26ca72
...@@ -2,21 +2,12 @@ ...@@ -2,21 +2,12 @@
#define _PAGECACHE_H #define _PAGECACHE_H
#ifdef CONFIG_SHRINK_PAGECACHE #ifdef CONFIG_SHRINK_PAGECACHE
enum page_cache_reclaim_flag {
PAGE_CACHE_RECLAIM_NO_UNMAP,
PAGE_CACHE_RECLAIM_UNMAP,
PAGE_CACHE_RECLAIM_WRITEPAGE,
PAGE_CACHE_RECLAIM_NR_FLAGS,
};
extern int pagecache_reclaim_enable; extern int pagecache_reclaim_enable;
extern int pagecache_limit_ratio; extern int pagecache_limit_ratio;
extern int pagecache_reclaim_ratio; extern int pagecache_reclaim_ratio;
int proc_page_cache_limit(struct ctl_table *table, int write, int proc_page_cache_limit(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos); 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);
#else #else
#endif #endif
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/swap.h>
#include <linux/page_cache_limit.h>
int pagecache_reclaim_enable; int pagecache_reclaim_enable;
int pagecache_limit_ratio; int pagecache_limit_ratio;
...@@ -144,31 +142,14 @@ static unsigned long node_nr_page_reclaim(int nid) ...@@ -144,31 +142,14 @@ static unsigned long node_nr_page_reclaim(int nid)
return nr_to_reclaim; return nr_to_reclaim;
} }
static void shrink_node_page_cache(int nid, gfp_t mask) static void shrink_node_page_cache(int nid)
{ {
int i;
unsigned long nr_to_reclaim; unsigned long nr_to_reclaim;
unsigned long nr_reclaimed;
enum page_cache_reclaim_flag flag;
nr_to_reclaim = node_nr_page_reclaim(nid); nr_to_reclaim = node_nr_page_reclaim(nid);
if (nr_to_reclaim <= 0)
return;
flag = 0;
for (i = PAGE_CACHE_RECLAIM_NO_UNMAP;
i < PAGE_CACHE_RECLAIM_NR_FLAGS; i++) {
nr_reclaimed = __shrink_node_page_cache(nid, mask, nr_to_reclaim, flag);
nr_to_reclaim -= nr_reclaimed;
if (nr_to_reclaim <= 0)
break;
flag |= i;
}
} }
static void shrink_page_cache(gfp_t mask) static void shrink_page_cache(void)
{ {
int nid; int nid;
...@@ -176,7 +157,7 @@ static void shrink_page_cache(gfp_t mask) ...@@ -176,7 +157,7 @@ static void shrink_page_cache(gfp_t mask)
return; return;
for_each_node_state(nid, N_MEMORY) for_each_node_state(nid, N_MEMORY)
shrink_node_page_cache(nid, mask); shrink_node_page_cache(nid);
} }
static DECLARE_COMPLETION(setup_done); static DECLARE_COMPLETION(setup_done);
...@@ -192,7 +173,7 @@ static int pagecache_limitd(void *arg) ...@@ -192,7 +173,7 @@ static int pagecache_limitd(void *arg)
set_freezable(); set_freezable();
for (;;) { for (;;) {
try_to_freeze(); try_to_freeze();
shrink_page_cache(GFP_KERNEL | __GFP_HIGHMEM); shrink_page_cache();
prepare_to_wait(pagecache_limitd_wait_queue[nid], &wait, prepare_to_wait(pagecache_limitd_wait_queue[nid], &wait,
TASK_INTERRUPTIBLE); TASK_INTERRUPTIBLE);
......
...@@ -64,10 +64,6 @@ ...@@ -64,10 +64,6 @@
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
#include <trace/events/vmscan.h> #include <trace/events/vmscan.h>
#ifdef CONFIG_SHRINK_PAGECACHE
#include <linux/page_cache_limit.h>
#endif
struct scan_control { struct scan_control {
/* How many pages shrink_list() should reclaim */ /* How many pages shrink_list() should reclaim */
unsigned long nr_to_reclaim; unsigned long nr_to_reclaim;
...@@ -128,9 +124,6 @@ struct scan_control { ...@@ -128,9 +124,6 @@ struct scan_control {
/* The file pages on the current node are dangerously low */ /* The file pages on the current node are dangerously low */
unsigned int file_is_tiny:1; unsigned int file_is_tiny:1;
/* can't shrink slab pages */
unsigned int no_shrink_slab:1;
/* Allocation order */ /* Allocation order */
s8 order; s8 order;
...@@ -2880,9 +2873,8 @@ static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc) ...@@ -2880,9 +2873,8 @@ static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc)
shrink_lruvec(lruvec, sc); shrink_lruvec(lruvec, sc);
if (!sc->no_shrink_slab) shrink_slab(sc->gfp_mask, pgdat->node_id, memcg,
shrink_slab(sc->gfp_mask, pgdat->node_id, memcg, sc->priority);
sc->priority);
/* Record the group's reclaim efficiency */ /* Record the group's reclaim efficiency */
vmpressure(sc->gfp_mask, memcg, false, vmpressure(sc->gfp_mask, memcg, false,
...@@ -4600,44 +4592,3 @@ struct page *get_page_from_vaddr(struct mm_struct *mm, unsigned long vaddr) ...@@ -4600,44 +4592,3 @@ struct page *get_page_from_vaddr(struct mm_struct *mm, unsigned long vaddr)
return page; return page;
} }
EXPORT_SYMBOL_GPL(get_page_from_vaddr); EXPORT_SYMBOL_GPL(get_page_from_vaddr);
#ifdef CONFIG_SHRINK_PAGECACHE
/*
* return the number of reclaimed pages
*/
unsigned long __shrink_node_page_cache(int nid, gfp_t mask, unsigned long nr_to_reclaim,
enum page_cache_reclaim_flag reclaim_flag)
{
struct scan_control sc = {
.nr_to_reclaim = nr_to_reclaim,
.gfp_mask = mask,
.may_swap = 0,
.may_unmap = reclaim_flag | PAGE_CACHE_RECLAIM_UNMAP,
.may_writepage = reclaim_flag | PAGE_CACHE_RECLAIM_WRITEPAGE,
.target_mem_cgroup = NULL,
.priority = DEF_PRIORITY,
.reclaim_idx = MAX_NR_ZONES,
.no_shrink_slab = 1,
};
struct zonelist *zonelist = node_zonelist(nid, __GFP_THISNODE);
struct reclaim_state *old_rs = current->reclaim_state;
unsigned long nr_reclaimed;
unsigned int noreclaim_flag;
if (!(mask & __GFP_RECLAIM))
return 0;
noreclaim_flag = memalloc_noreclaim_save();
fs_reclaim_acquire(sc.gfp_mask);
current->reclaim_state = NULL;
nr_reclaimed = do_try_to_free_pages(zonelist, &sc);
current->reclaim_state = old_rs;
fs_reclaim_release(sc.gfp_mask);
memalloc_noreclaim_restore(noreclaim_flag);
return nr_reclaimed;
}
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册