[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180504145435.GA26573@redhat.com>
Date: Fri, 4 May 2018 16:54:35 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Kirill Tkhai <ktkhai@...tuozzo.com>, akpm@...ux-foundation.org,
peterz@...radead.org, viro@...iv.linux.org.uk, mingo@...nel.org,
paulmck@...ux.vnet.ibm.com, keescook@...omium.org, riel@...hat.com,
tglx@...utronix.de, kirill.shutemov@...ux.intel.com,
marcos.souza.org@...il.com, hoeun.ryu@...il.com,
pasha.tatashin@...cle.com, gs051095@...il.com, dhowells@...hat.com,
rppt@...ux.vnet.ibm.com, linux-kernel@...r.kernel.org,
Balbir Singh <balbir@...ux.vnet.ibm.com>,
Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH] memcg: Replace mm->owner with mm->memcg
On 05/04, Eric W. Biederman wrote:
>
> Oleg Nesterov <oleg@...hat.com> writes:
>
> > OK, what about exec() ? mm_init_memcg() initializes bprm->mm->memcg early in
> > bprm_mm_init(). What if the execing task migrates before exec_mmap() ?
>
> We need the the cgroup when the mm is initialized. That way we have the
> cgroup information when initializing the mm.
Yes, we need to initialize new_mm->memcg but iiuc mostly for the error path,
> I don't know if a lock preventing changing the cgroup in exec or just
> a little bit of code in exec_mmap to ensure mm->memcg is properly set
> is the better approach.
I'd vote for the change in exec_mmap(). This way mm_init_memcg() can just
nullify mm->memcg.
> This does look like a very good place for an incremental patch to close
> that race.
Hmm. I think v2 makes more sense, but I won't argue.
Oleg.
Powered by blists - more mailing lists