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. If we can agree with using a flag in mm_struct in order to track whether each mm_struct was already evaluated for each out_of_memory() call, we can printk() only one thread from all thread groups sharing that mm_struct...