
From: Lu Jialin <lujialin4@huawei.com> hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4IMAK?from=project-issue CVE: NA -------- when CONFIG_MEMCG = n, compile error occurs mm/vmscan.c: In function ‘is_memcg_kswapd_stopped’: mm/vmscan.c:2849:11: error: dereferencing pointer to incomplete type ‘struct mem_cgroup’ if (memcg->memory.max == PAGE_COUNTER_MAX) Fix the error by modify is_memcg_kswapd_stopped function return false when CONFIG_MEMCG = n v2: add compile error message in commit msg Signed-off-by: Lu Jialin <lujialin4@huawei.com> Reviewed-by: weiyang wang <wangweiyang2@huawei.com> Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> --- mm/vmscan.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c index 5b5cc00b195b..1bfbe1fc67d0 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2839,6 +2839,7 @@ static inline bool should_continue_reclaim(struct pglist_data *pgdat, static bool is_memcg_kswapd_stopped(struct scan_control *sc) { +#ifdef CONFIG_MEMCG struct mem_cgroup *memcg = sc->target_mem_cgroup; bool is_stop = false; unsigned long stop_flag = 0; @@ -2854,6 +2855,9 @@ static bool is_memcg_kswapd_stopped(struct scan_control *sc) is_stop = page_counter_read(&memcg->memory) < stop_flag; return (current_is_kswapd() && is_stop); +#else + return false; +#endif } static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc) -- 2.20.1