Received: by 10.192.165.148 with SMTP id m20csp1931035imm; Thu, 3 May 2018 07:41:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZput1xyon1Dn7BoZ52hnQVsHQJddB0dJaO7sUXolYmNVzwLoXiaP1d+CNcUXoYQhoNVCkon X-Received: by 2002:a17:902:be06:: with SMTP id r6-v6mr24262139pls.158.1525358492549; Thu, 03 May 2018 07:41:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525358492; cv=none; d=google.com; s=arc-20160816; b=uqgozF4kMZjWq3m4vQGDtjgaW7ojzlbRlWmeSRY//3qnlCaorRSPgN8DgAS03yw7Qz CM0nITirey7dZaJSM92VfSzAv5qDtSQzE5Cn0LzFJpmoZw0jR4et+dugndvwxRn7V7Ig izASOSp8HenCEgrfjHnMXKC3r+Y9wsy3WJblOVSFv/m0F2E5Ecz87/ghJf3zj8YyViQD hiFmIphBC5/me+DLTGbcsj8ViZv0nRnnLVznho0gjRVRuK689UKdgJHVry0KFLrmzFM8 +RwJ/3Vgajnv0VhMYgXCvanh3uK1ZEJ4L0Ti7PX9+VziSObuoTWzvh3RszQsDIwCA0ZI GHXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=XbgVLdMkXR3mLd/TiOkN1CjCV7aL5BYepEXBoAdr3tI=; b=t5qg0QcGQmJftCRe0h+CCmQRPNBsrGRPR3d33Cve8odcA3XVZ1o/snFXO07mVa5XOu I8fcvuN0n+r3QMG0tUFgdBSqtzDpCcE+9f+sxdreAczepGasrHmANgFiQvITWA5ky+0W NDg2Kwr5YPWGA1RcJNIwrFX5SlbWd8WIHbLQVbgzgzfnfjvflXo3zXb/M+9DNbqt4vcw tWeSDXl8p0j2BMrrro+3s3agYzDncDggN0uRSOTmtlPZZ+a4ZD10f3PTCj9xGuiUEX6c s7mtTTb4AwpItfxrSIalYD863lsQCuXXxxegNC1ySvqSFoHz12y+up8VmFyOQwRa48xG o0tg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t29-v6si11900670pgo.539.2018.05.03.07.41.17; Thu, 03 May 2018 07:41:32 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751454AbeECOjP (ORCPT + 99 others); Thu, 3 May 2018 10:39:15 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:54765 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751027AbeECOjO (ORCPT ); Thu, 3 May 2018 10:39:14 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fEFO3-0001Qb-RK; Thu, 03 May 2018 08:39:11 -0600 Received: from [97.119.174.25] (helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fEFO2-0002Vz-PS; Thu, 03 May 2018 08:39:11 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Oleg Nesterov 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 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> <20180503133338.GA23401@redhat.com> Date: Thu, 03 May 2018 09:39:03 -0500 In-Reply-To: <20180503133338.GA23401@redhat.com> (Oleg Nesterov's message of "Thu, 3 May 2018 15:33:39 +0200") Message-ID: <87y3h0x0qg.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1fEFO2-0002Vz-PS;;;mid=<87y3h0x0qg.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.119.174.25;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19cLS7CrME7Ifkj3V6NEEyzbLSCtXYY4SU= X-SA-Exim-Connect-IP: 97.119.174.25 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa06.xmission.com X-Spam-Level: X-Spam-Status: No, score=-0.2 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01 autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Oleg Nesterov X-Spam-Relay-Country: X-Spam-Timing: total 312 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 5 (1.7%), b_tie_ro: 3.2 (1.0%), parse: 1.27 (0.4%), extract_message_metadata: 3.4 (1.1%), get_uri_detail_list: 1.17 (0.4%), tests_pri_-1000: 7 (2.2%), tests_pri_-950: 1.86 (0.6%), tests_pri_-900: 1.61 (0.5%), tests_pri_-400: 40 (12.7%), check_bayes: 38 (12.2%), b_tokenize: 11 (3.5%), b_tok_get_all: 11 (3.5%), b_comp_prob: 2.7 (0.9%), b_tok_touch_all: 7 (2.2%), b_finish: 3.8 (1.2%), tests_pri_0: 235 (75.5%), check_dkim_signature: 0.94 (0.3%), check_dkim_adsp: 2.9 (0.9%), tests_pri_500: 5 (1.7%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH] memcg: Replace mm->owner with mm->memcg X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oleg Nesterov 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