Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3157449pxk; Mon, 21 Sep 2020 06:44:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzG1S+24T0zyrfmo/YMkoXPWvJ4vtFA9TKG1WWH3itSPHQWC06soz8DiqRbPiSrFH/DAQBM X-Received: by 2002:aa7:d382:: with SMTP id x2mr53052007edq.108.1600695853595; Mon, 21 Sep 2020 06:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600695853; cv=none; d=google.com; s=arc-20160816; b=uZZndw1lq8dcnhTxGY2cLZmfD376GpTMmuSqocKlW4sKfvPymNr723OYv591ETXgio 76lekB47+VXSFUXF1BM47KG+TexMwQpsC5RSDGKYmKbr20JH/HIKBpR629z/qaJWDlgw mLLG9tYOLCON9F9+yq8/ovSBEeUK902EbTvVxFBbtjDzX2IUHpLmtkUuW4N73XFC1sZM U62F86zyFLPEmJimzcmP/vIg+onBXceqvEnCrkrcQi3mVRl4aZiWRI7lJCgjl/JxRoHJ 9VONAM6hVUgyYDGymac0vSMPwDBHB1mu3o0DGPCGf6Or1VE/nXb+JzJZHdW8bH4A4+pP GVqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KvHE3U1LvO1bVCa3Khho6+5CSamK6xUOF4Y3QnJxLf0=; b=SJNsF22OUwOm0m0x74t4HUgXR8ONXyOGcZ8KyV342Ekkaw4l+CoV5zVbT4rmcGurIQ 8zB4NXzgZ2yAcHwsM4D14D/qNWnTrQusr0tvN2/j939Y5lwS4dBKn2DaSn/goexb/50V LRHgKziSTZxo3YnbB9HC+leiJAjs9ZpSq9Lu7y1mKXWwzjiKtuZLOFywp876i+bhghv1 h5gpbxEvNPEMWSs3tq/f4u0q0jU6JYwTwLpAXQCq+dGlDvtJYOy/tPxBsE+RIhGHThq5 2NY8h74KitM8g4hvvjR5LE/ON9scSiKs/4LFWDxmoh8Lm/xiXVchCAhwsTx/EQrPEAf7 dTFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ELeLjLwl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u12si8226074ejj.566.2020.09.21.06.43.47; Mon, 21 Sep 2020 06:44:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ELeLjLwl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727124AbgIUNmE (ORCPT + 99 others); Mon, 21 Sep 2020 09:42:04 -0400 Received: from mx2.suse.de ([195.135.220.15]:56646 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726471AbgIUNmD (ORCPT ); Mon, 21 Sep 2020 09:42:03 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1600695721; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KvHE3U1LvO1bVCa3Khho6+5CSamK6xUOF4Y3QnJxLf0=; b=ELeLjLwlpBK2v6UX46KlSnK5+qpsIBAJVcb3r4tGfmzE/H0dzwknKl46MJLrI0n19/etBm avZE1bfe4mLUTlx2oXiOSXnaKvBOPegJ90z+F3C6UWSFZ9yTc0d6rdT9k+Ql/4sPpH/Euu KgCmMOsiH/WBo/NBPwkCMXLnQh44RQQ= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E3750B1B8; Mon, 21 Sep 2020 13:42:37 +0000 (UTC) Date: Mon, 21 Sep 2020 15:42:00 +0200 From: Michal Hocko To: Peter Xu , Tejun Heo , Christian Brauner Cc: Linus Torvalds , Jason Gunthorpe , John Hubbard , Leon Romanovsky , Linux-MM , Linux Kernel Mailing List , "Maya B . Gokhale" , Yang Shi , Marty Mcfadden , Kirill Shutemov , Oleg Nesterov , Jann Horn , Jan Kara , Kirill Tkhai , Andrea Arcangeli , Christoph Hellwig , Andrew Morton Subject: Re: [PATCH 1/4] mm: Trial do_wp_page() simplification Message-ID: <20200921134200.GK12990@dhcp22.suse.cz> References: <20200915213330.GE2949@xz-x1> <20200915232238.GO1221970@ziepe.ca> <20200916174804.GC8409@ziepe.ca> <20200916184619.GB40154@xz-x1> <20200917112538.GD8409@ziepe.ca> <20200917193824.GL8409@ziepe.ca> <20200918164032.GA5962@xz-x1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200918164032.GA5962@xz-x1> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Cc Tejun and Christian - this is a part of a larger discussion which is not directly related to this particular question so let me trim the original email to the bare minimum.] On Fri 18-09-20 12:40:32, Peter Xu wrote: [...] > One issue is when we charge for cgroup we probably can't do that onto the new > mm/task, since copy_namespaces() is called after copy_mm(). I don't know > enough about cgroup, I thought the child will inherit the parent's, but I'm not > sure. Or, can we change that order of copy_namespaces() && copy_mm()? I don't > see a problem so far but I'd like to ask first.. I suspect you are referring to CLONE_INTO_CGROUP, right? I have only now learned about this feature so I am not deeply familiar with all the details and I might be easily wrong. Normally all the cgroup aware resources are accounted to the parent's cgroup. For memcg that includes all the page tables, early CoW and other allocations with __GFP_ACCOUNT. IIUC CLONE_INTO_CGROUP properly then this hasn't changed as the child is associated to its new cgroup (and memcg) only in cgroup_post_fork. If that is correct then we might have quite a lot of resources bound to child's lifetime but accounted to the parent's memcg which can lead to all sorts of interesting problems (e.g. unreclaimable memory - even by the oom killer). Christian, Tejun is this the expected semantic or I am just misreading the code? -- Michal Hocko SUSE Labs