提交 58824c83 编写于 作者: L Lu Jialin 提交者: Zheng Zengkai

cgroup: fix compile error when CONFIG_MEMCG = n

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: NLu Jialin <lujialin4@huawei.com>
Reviewed-by: Nweiyang wang <wangweiyang2@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 b297b0eb
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册