Received: by 10.192.165.148 with SMTP id m20csp1856715imm; Thu, 3 May 2018 06:34:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrGCa+K8vRsxj9dpK7k6LVCl8i31tGwJ31nWss8gGM3XZ1r9rc7saMuRFKRGQR1MwxVHwBe X-Received: by 2002:a63:7b0f:: with SMTP id w15-v6mr18610761pgc.405.1525354491263; Thu, 03 May 2018 06:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525354491; cv=none; d=google.com; s=arc-20160816; b=kozWQ4VXbPOJflamnIDZ47K8F5jb+RhyuoikXkYs5dKojhZaZY/8M+K0rROO5EcEAy UOxOSZcQgZ6gt7hWnjIJivm5dCIiya95WHRf0h1bNpOVP1fkkTB8S2gupy/KBZKeRX0e YjEeujb2OdgddJXZyiQSA9N0SsLihChp3kEAcgfULqrsbvNpoEwNZhL6Jn05BNwXEnb4 hi8BCAZc9hE4eoI78sv6aSEA0RrMQqtbvFaS6NvEtGgkKWQ105EmczydPGjeF8T1xOU4 0BejtVViU6glNb7yNKcDNHfbgrxs4xR2Yl+JQUrtqOmTAAiqFnQ/iHfsEkYNbZdhns7C KB4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=A8rItm+YHyUN794Ep82ikQtMXV8fvg4njvK4SdF8NQ4=; b=ItlgF5OYVSu40Kw/yP2koGSO5mv7jHSm6B4Tpn4ofpXPBPVEL7eDT7iSb3+FMxnhMp AUDfh5yu/JIMbt4f2c3lfY7FA2tl6SvTO0ziEok5TaorjVwQx/n08oVD28sz/hSPePbQ bgjSUsEYRZIQlQJarb2LkaMUmj3hHw090VORbkPYslRgMO9DE6VQ8XiXgeGQr1zCHlM7 Rm3DcUU6n3Wg4eezgLCHCDJ4a19qpgwc8YoqEbyOzpfI/sXnN+jB1ot4jaSwkJZJaozT IzDHMQYNqVqZVmoQtSZnaP+WEN6SQTEHqK/9uiBABtIC6id48V22AtA4QL1ME2uGO/3I mlUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h68si13662518pfa.238.2018.05.03.06.34.06; Thu, 03 May 2018 06:34:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751262AbeECNdr (ORCPT + 99 others); Thu, 3 May 2018 09:33:47 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50588 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750930AbeECNdo (ORCPT ); Thu, 3 May 2018 09:33:44 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B25E181A88BD; Thu, 3 May 2018 13:33:43 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.34.27.30]) by smtp.corp.redhat.com (Postfix) with SMTP id EB08E2024CA1; Thu, 3 May 2018 13:33:39 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 3 May 2018 15:33:43 +0200 (CEST) Date: Thu, 3 May 2018 15:33:39 +0200 From: Oleg Nesterov To: "Eric W. Biederman" Cc: Johannes Weiner , Michal Hocko , Kirill Tkhai , akpm@linux-foundation.org, peterz@infradead.org, viro@zeniv.linux.org.uk, mingo@kernel.org, paulmck@linux.vnet.ibm.com, keescook@chromium.org, riel@redhat.com, tglx@linutronix.de, kirill.shutemov@linux.intel.com, marcos.souza.org@gmail.com, hoeun.ryu@gmail.com, pasha.tatashin@oracle.com, gs051095@gmail.com, dhowells@redhat.com, rppt@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, Balbir Singh , Tejun Heo Subject: Re: [PATCH] memcg: Replace mm->owner with mm->memcg Message-ID: <20180503133338.GA23401@redhat.com> References: <20180426130700.GP17484@dhcp22.suse.cz> <87efj2q6sq.fsf@xmission.com> <20180426192818.GX17484@dhcp22.suse.cz> <20180427070848.GA17484@dhcp22.suse.cz> <87r2n01q58.fsf@xmission.com> <87o9hz2sw3.fsf@xmission.com> <87h8nr2sa3.fsf_-_@xmission.com> <20180502084708.GC26305@dhcp22.suse.cz> <20180502132026.GB16060@cmpxchg.org> <87lgd1zww0.fsf_-_@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87lgd1zww0.fsf_-_@xmission.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 03 May 2018 13:33:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 03 May 2018 13:33:43 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'oleg@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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() ? Oleg.