Received: by 10.213.84.227 with SMTP id q3csp7695imm; Wed, 9 May 2018 07:52:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZousH4Y/s8vSb168jRhzbX1DkzLxQxiE2p3CcVT4npgP+ahdIjAL1OBEpaor9mUq1my9Upq X-Received: by 2002:a63:b60f:: with SMTP id j15-v6mr361831pgf.215.1525877578446; Wed, 09 May 2018 07:52:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525877578; cv=none; d=google.com; s=arc-20160816; b=VfcilB5xqCkOnRxcaiYyh6iSqhRedHRXpzAQK0fcmcP8cZCTPMSeOzR/4q0V/oTOo/ QezKczfiLUQB65zlukn2UPVF3uHrWxFWaIQhP7TqWa51y93bA0IY5Boc+DkOO9lRAQLy zRkq9o821UMhgrL8NCRlaGB+/JUO3X6lpsLoz5itL/DN7cAxTumi1oPmaz1PMbMjNq9e 4lr/3nHuh/ojdgMoKeNlhdyp0V9QxLzgP5R2tImwIae3Hmu4ybABdZkEuRVH2TzczA77 cPt0GGQFzEhEVGf6yq5PnKIRMvgl4f0MUdU3EyW18NC23ClgpSZhs15+VN4svZvY3O4Z zUGg== 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=Tfthp+yUWl0gJsFdDwapXO2HMwh9UDmo7kfuH2WN274=; b=kYHcf9eSS9hJZrljPq8YapMuLvDB6C1j3oKaGkgHVu4V5PLz+IBRtvyW0n+6brbBwu Ro/gQNYP5s2Tp1iczmA+qhzq44abQHFc63lT1o0LKSb4V6H8yWjPZpUrjtG7Ga/Sbt0v ty6MRt/jYfYmV/Rs7s201Md1kxsM6n7i2b29ITX3H3v9W7S6xi8u5NF4YtQRHf2QlyKy XBM4v1xAlMtQs4B1Uzhazws5fQgyDTKTPAPn8k+Gvo0CmnC+JMS69Gxey8Q/C8zArG6Y qbHc4syCDoBi8Uc+RpLmos9xuNzHcXOSgcewEOhySCk9xCVzxq1XjvcYt3TUQCIEzcCF 19sQ== 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 b89-v6si26592976plb.262.2018.05.09.07.52.42; Wed, 09 May 2018 07:52:58 -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 S935252AbeEIOv5 (ORCPT + 99 others); Wed, 9 May 2018 10:51:57 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:32922 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934517AbeEIOv4 (ORCPT ); Wed, 9 May 2018 10:51:56 -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 02ED7406F88F; Wed, 9 May 2018 14:51:56 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.34.27.30]) by smtp.corp.redhat.com (Postfix) with SMTP id A54632022EEE; Wed, 9 May 2018 14:51:52 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 9 May 2018 16:51:55 +0200 (CEST) Date: Wed, 9 May 2018 16:51:52 +0200 From: Oleg Nesterov To: "Eric W. Biederman" Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Kirill Tkhai , 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 2/2] memcg: Close the race between migration and installing bprm->mm as mm Message-ID: <20180509145151.GB25742@redhat.com> References: <20180503133338.GA23401@redhat.com> <87y3h0x0qg.fsf@xmission.com> <20180504142056.GA26151@redhat.com> <87r2mrh4is.fsf@xmission.com> <20180504145435.GA26573@redhat.com> <87y3gzfmjt.fsf@xmission.com> <20180504162209.GB26573@redhat.com> <871serfk77.fsf@xmission.com> <87tvrncoyc.fsf_-_@xmission.com> <87fu37cow4.fsf_-_@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87fu37cow4.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.7]); Wed, 09 May 2018 14:51:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 09 May 2018 14:51:56 +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/04, Eric W. Biederman wrote: > > --- a/fs/exec.c > +++ b/fs/exec.c > @@ -1044,6 +1044,8 @@ static int exec_mmap(struct mm_struct *mm) > return 0; > } > mmdrop(active_mm); > + /* The tsk may have migrated before the new mm was attached */ > + mm_sync_memcg_from_task(tsk); > return 0; > } call_usermodehelper(). perhaps it makes sense to change flush_old_exec() to clear PF_KTHREAD/etc before exec_mmap(). Oleg.