From: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> Subject: mm: memcontrol: use CSS_TASK_ITER_PROCS at mem_cgroup_scan_tasks() Since c03cd7738a83b137 ("cgroup: Include dying leaders with live threads in PROCS iterations") corrected how CSS_TASK_ITER_PROCS works, mem_cgroup_scan_tasks() can use CSS_TASK_ITER_PROCS in order to check only one thread from each thread group. [penguin-kernel@xxxxxxxxxxxxxxxxxxx: remove thread group leader check in oom_evaluate_task()] Link: http://lkml.kernel.org/r/1560853257-14934-1-git-send-email-penguin-kernel@xxxxxxxxxxxxxxxxxxx Link: http://lkml.kernel.org/r/c763afc8-f0ae-756a-56a7-395f625b95fc@xxxxxxxxxxxxxxxxxxx Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> Acked-by: Michal Hocko <mhocko@xxxxxxxx> Reviewed-by: Shakeel Butt <shakeelb@xxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 2 +- mm/oom_kill.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) --- a/mm/memcontrol.c~mm-memcontrol-use-css_task_iter_procs-at-mem_cgroup_scan_tasks +++ a/mm/memcontrol.c @@ -1160,7 +1160,7 @@ int mem_cgroup_scan_tasks(struct mem_cgr struct css_task_iter it; struct task_struct *task; - css_task_iter_start(&iter->css, 0, &it); + css_task_iter_start(&iter->css, CSS_TASK_ITER_PROCS, &it); while (!ret && (task = css_task_iter_next(&it))) ret = fn(task, arg); css_task_iter_end(&it); --- a/mm/oom_kill.c~mm-memcontrol-use-css_task_iter_procs-at-mem_cgroup_scan_tasks +++ a/mm/oom_kill.c @@ -346,9 +346,6 @@ static int oom_evaluate_task(struct task if (!points || points < oc->chosen_points) goto next; - /* Prefer thread group leaders for display purposes */ - if (points == oc->chosen_points && thread_group_leader(oc->chosen)) - goto next; select: if (oc->chosen) put_task_struct(oc->chosen); _