On Tue 17-03-20 13:36:45, Roman Gushchin wrote: [...] > > > And the we can put something like > > > if (WARN_ON_ONCE(!mem_cgroup_is_descendant(memcg, oom_domain))) > > > goto out; > > > to mem_cgroup_get_oom_group? > > > > This would be a user triggerable warning and that sounds like a bad idea > > to me. We should just live with races. The only question I still do not > > have a proper answer for is how much we do care. If we do not care all > > that much about the original memcg then go with your patch. But if we > > want to be slightly more careful then we should note the memcg in > > oom_evaluate_task and use it when killing. > > But it won't close the race, right? > > oom_evaluate_task() can race with a task migration too, so we can record > the old or the new cgroup. Are you sure? I thought that cgroups iterator code would take care of those races. The documentation doesn't tell much in that respect. Maybe it would be good to add a clarification there. > Then I'd stick with my original patch which solves the main problem here: > unnecessary killing of too many tasks. OK, I am fine with that. I couldn't convince myself that the other part of the problem is serious enough. Maybe we will find workloads which do care and we can add that later on. -- Michal Hocko SUSE Labs