On Tue, 8 Feb 2011 11:13:51 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote: > On Mon, 7 Feb 2011 18:13:22 -0800 (PST) > David Rientjes <rientjes@xxxxxxxxxx> wrote: > > > On Tue, 8 Feb 2011, KAMEZAWA Hiroyuki wrote: > > > > > > +static int mem_cgroup_oom_delay_millisecs_write(struct cgroup *cgrp, > > > > + struct cftype *cft, u64 val) > > > > +{ > > > > + struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); > > > > + struct mem_cgroup *iter; > > > > + > > > > + if (val > MAX_SCHEDULE_TIMEOUT) > > > > + return -EINVAL; > > > > + > > > > + for_each_mem_cgroup_tree(iter, memcg) { > > > > + iter->oom_delay = msecs_to_jiffies(val); > > > > + memcg_oom_recover(iter); > > > > + } > > > > + return 0; > > > > > > Seems nicer and it seems you tries to update all children cgroups. > > > > > > BTW, with above code, with following heirarchy, > > > > > > A > > > / > > > B > > > / > > > C > > > > > > When a user set oom_delay in order as A->B->C, A,B,C can have 'different' numbers. > > > When a user set oom_delay in order as C->B->A, A,B,C will have the same numbers. > > > > > > This intreface seems magical, or broken. > > > > > > > It's not really magical, it just means that if you change the delay for a > > memcg that you do so for all of its children implicitly as well. > > > But you didn't explain the bahavior in Documenation. > And write this fact: A / B / C When A.memory_oom_delay=1sec. B.memory_oom_delay=500msec C.memory_oom_delay=200msec If there are OOM in group C, C's oom_kill will be delayed for 200msec and a task in group C will be killed. If there are OOM in group B, B's oom_kill will be delayed for 200msec and a task in group B or C will be killed. If there are OOM in group A, A's oom_kill will be delayed for 1sec and a task in group A,B or C will be killed. oom_killer in the hierarchy is serialized by lock and happens one-by-one for avoiding a serial kill. So, above delay can be stacked. Thanks, -Kame -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>