[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100316090124.ab20e093.kamezawa.hiroyu@jp.fujitsu.com>
Date: Tue, 16 Mar 2010 09:01:24 +0900
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"balbir@...ux.vnet.ibm.com" <balbir@...ux.vnet.ibm.com>,
"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>,
"kirill@...temov.name" <kirill@...temov.name>
Subject: Re: [PATCH 1/3] memcg: oom wakeup filter
On Mon, 15 Mar 2010 14:50:13 -0700
Andrew Morton <akpm@...ux-foundation.org> wrote:
> On Fri, 12 Mar 2010 14:31:37 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:
>
> > +static int memcg_oom_wake_function(wait_queue_t *wait,
> > + unsigned mode, int sync, void *arg)
> > +{
> > + struct mem_cgroup *wake_mem = (struct mem_cgroup *)arg;
> > + struct oom_wait_info *oom_wait_info;
> > +
> > + /* both of oom_wait_info->mem and wake_mem are stable under us */
> > + oom_wait_info = container_of(wait, struct oom_wait_info, wait);
> > +
> > + if (oom_wait_info->mem == wake_mem)
> > + goto wakeup;
> > + /* if no hierarchy, no match */
> > + if (!oom_wait_info->mem->use_hierarchy || !wake_mem->use_hierarchy)
> > + return 0;
> > + /* check hierarchy */
> > + if (!css_is_ancestor(&oom_wait_info->mem->css, &wake_mem->css) &&
> > + !css_is_ancestor(&wake_mem->css, &oom_wait_info->mem->css))
> > + return 0;
> > +
> > +wakeup:
> > + return autoremove_wake_function(wait, mode, sync, arg);
> > +}
>
> What are the locking rules for calling css_is_ancestor()?
css_is_ancestor is checking css->id (and hierarchy stack). What we need here is
to guarantee css is valid object.
Here, we have reference count of both of oom_wait_info->mem and wake_mem.
Then, ->css is always vaild and it's "id" is stable under us.
Hmm, maybe this comment is too short.
/* both of oom_wait_info->mem and wake_mem are stable under us */
I'll prepare some update.
Thanks,
-Kame
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists