On Tue, Jul 17, 2018 at 01:41:33PM -0700, David Rientjes wrote: > On Tue, 17 Jul 2018, Roman Gushchin wrote: > > > > > Let me show my proposal on examples. Let's say we have the following hierarchy, > > > > and the biggest process (or the process with highest oom_score_adj) is in D. > > > > > > > > / > > > > | > > > > A > > > > | > > > > B > > > > / \ > > > > C D > > > > > > > > Let's look at different examples and intended behavior: > > > > 1) system-wide OOM > > > > - default settings: the biggest process is killed > > > > - D/memory.group_oom=1: all processes in D are killed > > > > - A/memory.group_oom=1: all processes in A are killed > > > > 2) memcg oom in B > > > > - default settings: the biggest process is killed > > > > - A/memory.group_oom=1: the biggest process is killed > > > > > > Huh? Why would you even consider A here when the oom is below it? > > > /me confused > > > > I do not. > > This is exactly a counter-example: A's memory.group_oom > > is not considered at all in this case, > > because A is above ooming cgroup. > > > > I think the confusion is that this says A/memory.group_oom=1 and then the > biggest process is killed, which doesn't seem like it matches the > description you want to give memory.group_oom. It matches perfectly, as the description says that the kernel will look for the most high-level cgroup with group_oom set up to the OOM domain. Here B is oom domain, so A's settings are irrelevant. > > > > > - B/memory.group_oom=1: all processes in B are killed > > > > > > - B/memory.group_oom=0 && > > > > - D/memory.group_oom=1: all processes in D are killed > > > > > > What about? > > > - B/memory.group_oom=1 && D/memory.group_oom=0 > > > > All tasks in B are killed. > > > > Group_oom set to 1 means that the workload can't tolerate > > killing of a random process, so in this case it's better > > to guarantee consistency for B. > > > > This example is missing the usecase that I was referring to, i.e. killing > all processes attached to a subtree because the limit on a common ancestor > has been reached. > > In your example, I would think that the memory.group_oom setting of /A and > /A/B are meaningless because there are no processes attached to them. > > IIUC, your proposal is to select the victim by whatever means, check the > memory.group_oom setting of that victim, and then either kill the victim > or all processes attached to that local mem cgroup depending on the > setting. Sorry, I don't get what are you saying. In cgroup v2 processes can't be attached to A and B. There is no such thing as "local mem cgroup" at all. Thanks!