Re: [PATCH 1/2 v2] memcg: make oom_lock 0 and 1 based rather thancoutner

From: Johannes Weiner
Date: Tue Aug 09 2011 - 11:38:24 EST


On Tue, Aug 09, 2011 at 05:22:18PM +0200, Michal Hocko wrote:
> On Tue 09-08-11 16:03:12, Johannes Weiner wrote:
> > struct mem_cgroup *iter, *failed = NULL;
> > bool cond = true;
> >
> > for_each_mem_cgroup_tree_cond(iter, mem, cond) {
> > - bool locked = iter->oom_lock;
> > -
> > - iter->oom_lock = true;
> > - if (lock_count == -1)
> > - lock_count = iter->oom_lock;
> > - else if (lock_count != locked) {
> > + if (iter->oom_lock) {
> > /*
> > * this subtree of our hierarchy is already locked
> > * so we cannot give a lock.
> > */
> > - lock_count = 0;
> > failed = iter;
> > cond = false;
> > - }
> > + } else
> > + iter->oom_lock = true;
> > }
> >
> > if (!failed)
>
> We can return here and get rid of done label.

Ah, right you are. Here is an update.

---