Re: [-mm patch] Show memcg information during OOM

Balbir Singh
2009-02-03T04:56:36Z

* David Rientjes <rientjes@google.com> [2009-02-02 20:47:05]:

> On Tue, 3 Feb 2009, Balbir Singh wrote:
>
> > > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> > > > index d3b9bac..b8e53ae 100644
> > > > --- a/mm/oom_kill.c
> > > > +++ b/mm/oom_kill.c
> > > > @@ -392,6 +392,7 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
> > > > current->comm, gfp_mask, order, current->oomkilladj);
> > > > task_lock(current);
> > > > cpuset_print_task_mems_allowed(current);
> > > > + mem_cgroup_print_mem_info(mem);
> > >
> > > I think this can be put outside the task lock. The lock is used to call task_cs() safely in
> > > cpuset_print_task_mems_allowed().
> > >
> >
> > Thanks, I'll work on that in the next version.
> >
>
> I was also wondering about this and assumed that it was necessary to
> prevent the cgroup from disappearing during the oom. If task_lock() isn't
> held, is the memcg->css.cgroup->dentry->d_name.name dereference always
> safe without rcu?
>

oom_kill_process is called with tasklist_lock held (read-mode). That
should suffice, no? The memcg cannot go away since it has other groups
or tasks associated with it.

--
Balbir