lkml.org 
[lkml]   [2018]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] memcg: Replace mm->owner with mm->memcg
Oleg Nesterov <oleg@redhat.com> writes:

> On 05/02, Eric W. Biederman wrote:
>>
>> +static void mem_cgroup_fork(struct task_struct *tsk)
>> +{
>> + struct cgroup_subsys_state *css;
>> +
>> + rcu_read_lock();
>> + css = task_css(tsk, memory_cgrp_id);
>> + if (css && css_tryget(css))
>> + task_update_memcg(tsk, mem_cgroup_from_css(css));
>> + rcu_read_unlock();
>> +}
>
> Why do we need it?
>
> The child's mm->memcg was already initialized by mm_init_memcg() and we can't
> race with migrate until cgroup_threadgroup_change_end() ?

I admit I missed the cgroup_threadgroup_change_begin
cgroup_threadgroup_change_end pair in fs fork. In this case it doesn't
matter because mm_init_memcg is called from:

copy_mm
dup_mm
mm_init

And copy_mm is called before we call cgroup_threadgroup_change_begin.
So the race remains.

We could move move cgroup_threadgroup_change_begin earlier, to remove
the need for mem_cgroup_fork. But I have not analyzed that.

Eric

\
 
 \ /
  Last update: 2018-05-03 16:39    [W:0.167 / U:7.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site