hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I7R48G
----------------------------------------------------------------------
Remove the ksm_merge_any status, as the ksm status of processes within the same cgroup may not be consistent, since the prctl interface can also change the ksm status of a process. Therefore, the ksm_merge_any status may not always represent the ksm status of all processes within a cgroup. Remove it.
Signed-off-by: Longlong Xia xialonglong1@huawei.com --- include/linux/memcontrol.h | 4 ---- mm/memcontrol.c | 9 --------- 2 files changed, 13 deletions(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 16b3666393f2..0219e670a436 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -402,11 +402,7 @@ struct mem_cgroup { KABI_RESERVE(3) KABI_RESERVE(4) #endif -#ifdef CONFIG_KSM - KABI_USE(5, bool ksm_merge_any) -#else KABI_RESERVE(5) -#endif #if defined(CONFIG_DYNAMIC_HUGETLB) && defined(CONFIG_ARM64) KABI_USE(6, struct dhugetlb_pool *hpool) #else diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 5082d0664adf..c32010692a1b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5724,9 +5724,6 @@ static int memcg_set_ksm_for_tasks(struct mem_cgroup *memcg, bool enable) struct css_task_iter it; int ret = 0;
- if (enable == READ_ONCE(memcg->ksm_merge_any)) - return 0; - css_task_iter_start(&memcg->css, CSS_TASK_ITER_PROCS, &it); while (!ret && (task = css_task_iter_next(&it))) { if (__task_is_dying(task)) @@ -5781,7 +5778,6 @@ static int memory_ksm_show(struct seq_file *m, void *v) } css_task_iter_end(&it);
- seq_printf(m, "merge any state: %d\n", READ_ONCE(memcg->ksm_merge_any)); seq_printf(m, "merge any tasks: %u\n", tasks); seq_printf(m, "ksm_rmap_items %lu\n", ksm_rmap_items); seq_printf(m, "ksm_merging_pages %lu\n", ksm_merging_pages); @@ -5808,8 +5804,6 @@ static ssize_t memory_ksm_write(struct kernfs_open_file *of, char *buf, if (err) return err;
- WRITE_ONCE(memcg->ksm_merge_any, enable); - return nbytes; } #endif /* CONFIG_KSM */ @@ -6374,9 +6368,6 @@ mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) if (parent != root_mem_cgroup) memory_cgrp_subsys.broken_hierarchy = true; } -#ifdef CONFIG_KSM - memcg->ksm_merge_any = false; -#endif /* The following stuff does not apply to the root */ if (!parent) { root_mem_cgroup = memcg;