On 2019/06/16 6:33, Tetsuo Handa wrote: > On 2019/06/16 3:50, Shakeel Butt wrote: >>> While dump_tasks() traverses only each thread group, mem_cgroup_scan_tasks() >>> traverses each thread. >> >> I think mem_cgroup_scan_tasks() traversing threads is not intentional >> and css_task_iter_start in it should use CSS_TASK_ITER_PROCS as the >> oom killer only cares about the processes or more specifically >> mm_struct (though two different thread groups can have same mm_struct >> but that is fine). > > We can't use CSS_TASK_ITER_PROCS from mem_cgroup_scan_tasks(). I've tried > CSS_TASK_ITER_PROCS in an attempt to evaluate only one thread from each > thread group, but I found that CSS_TASK_ITER_PROCS causes skipping whole > threads in a thread group (and trivially allowing "Out of memory and no > killable processes...\n" flood) if thread group leader has already exited. Seems that CSS_TASK_ITER_PROCS from mem_cgroup_scan_tasks() is now working. Maybe I was confused due to without commit 7775face207922ea ("memcg: killed threads should not invoke memcg OOM killer"). We can scan one thread from each thread group, and remove /* Prefer thread group leaders for display purposes */ if (points == oc->chosen_points && thread_group_leader(oc->chosen)) goto next; check.