lkml.org 
[lkml]   [2009]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 3/4] memcg: fix OOM KILL under hierarchy
On Tue, 13 Jan 2009 16:33:12 +0800
Li Zefan <lizf@cn.fujitsu.com> wrote:

> > -int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem)
> > +static int
> > +mm_match_cgroup_hierarchy(struct mm_struct *mm, struct mem_cgroup *mem)
> > +{
> > + struct mem_cgroup *curr;
> > + int ret;
> > +
> > + if (!mm)
> > + return 0;
> > + rcu_read_lock();
> > + curr = mem_cgroup_from_task(mm->owner);
>
> curr can be NULL ?
>
Good Catch! You're right.

> > + if (mem->use_hierarchy)
> > + ret = css_is_ancestor(&curr->css, &mem->css);
> > + else
> > + ret = (curr == mem);
> > + rcu_read_unlock();
> > + return ret;
> > +}
> > +
>
> ...
>
> > +void mem_cgroup_update_oom_jiffies(struct mem_cgroup *mem)
> > +{
> > + struct mem_cgroup *cur;
> > + struct cgroup_subsys_state *css;
> > + int id, found;
> > +
> > + if (!mem->use_hierarchy) {
> > + mem->last_oom_jiffies = jiffies;
> > + return;
> > + }
> > +
> > + id = 0;
> > + rcu_read_lock();
> > + while (1) {
> > + css = css_get_next(&mem_cgroup_subsys, id, &mem->css, &found);
> > + if (!css)
> > + break;
> > + if (css_tryget(css)) {
> > + cur = container_of(css, struct mem_cgroup, css);
> > + cur->last_oom_jiffies = jiffies;
> > + css_put(css);
> > + }
> > + id = found + 1;
> > + }
> > + rcu_read_unlock();
> > + return;
>
> redundant "return"
>
ok, will remove it.

Thank you.
-Kame



\
 
 \ /
  Last update: 2009-01-13 10:29    [W:0.043 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site