Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3203440pxk; Mon, 21 Sep 2020 07:48:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdG1OKJUhTtVl8UNvHJBNjBKSU8vL8KAgVMDNfQWqWLBfgIiIN+qZ1PtQHStGeKdJFPj/L X-Received: by 2002:a17:906:95cf:: with SMTP id n15mr47061817ejy.14.1600699680372; Mon, 21 Sep 2020 07:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600699680; cv=none; d=google.com; s=arc-20160816; b=EPFGqR9dKDTb1s2nq9MpcFPt6kejErh4sim+6eOvxvtnnSMrE1uQHCUfgrSzAyFZhj 7wOsvuzaWZg6y5vv8Te2FFVHDtnC6SBs8NLzgwMPzhhBN6peSzmaI4pHkCBiPt3ex+6y gMQKQanlXX9F6piTtKb6D9jtYol0qqQF2eWJ4e+7HggeZaHhNKS4eEMqHKO6dfbRxO+1 +LsXQnmZzs0bHG/IjN3H0WuBL5V3pT1mIxqOnThP/YTXRXE+gP4ooV+md9vFCQ1CnAn8 EScwrAhcEeBvXxkvcp6V26+IyTs04oTx79ox0fcJtScDKcom/Fshtb7EOtHJ1K8NJSGF oVRA== 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; bh=aQF6meVzMXhhl6JGNKJWe37EEk2WGfKzOpCr4uDykK8=; b=AJxafMqpjssfhS4oBrcZ1mPXevKUbcdfap1co4rfGo3A4cIiiQSz7aaX30y8YkDynH F7LPF8rCQvsjyTDk2Ga44Ym71keVNUt3HqB2XK/LpGQk/kChaXxQ2ONI672OUlBgD0tN 3Fq1y+XSYwvGu2wuU8ZGOBwjWkSccurKT8nkPT5rwaq1tcx+6ul6FudqbEGC2BovrVIW 58pVx152uKOywR+VsbbiwAN7zo0BcGrwXtJUyOXt/7XsFe4PKZFJMv3tAFTyeHDTKrNH stlbfYoHpUU4hBtNQfIspn/3oGc03J3bS/rA8k1BygY8nHSjXovSWSkoncm6odJsHV4A xSbA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v19si8685217ejy.466.2020.09.21.07.47.36; Mon, 21 Sep 2020 07:48:00 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728009AbgIUOoG (ORCPT + 99 others); Mon, 21 Sep 2020 10:44:06 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:35619 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727948AbgIUOoG (ORCPT ); Mon, 21 Sep 2020 10:44:06 -0400 Received: from ip5f5af089.dynamic.kabel-deutschland.de ([95.90.240.137] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kKN2q-0003YE-9b; Mon, 21 Sep 2020 14:43:56 +0000 Date: Mon, 21 Sep 2020 16:43:55 +0200 From: Christian Brauner To: Tejun Heo Cc: Michal Hocko , Peter Xu , 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: <20200921144355.mrzc66lina3dkfjq@wittgenstein> References: <20200916184619.GB40154@xz-x1> <20200917112538.GD8409@ziepe.ca> <20200917193824.GL8409@ziepe.ca> <20200918164032.GA5962@xz-x1> <20200921134200.GK12990@dhcp22.suse.cz> <20200921141830.GE5962@xz-x1> <20200921142834.GL12990@dhcp22.suse.cz> <20200921143847.GB4268@mtj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200921143847.GB4268@mtj.duckdns.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 21, 2020 at 10:38:47AM -0400, Tejun Heo wrote: > Hello, > > On Mon, Sep 21, 2020 at 04:28:34PM +0200, Michal Hocko wrote: > > Fundamentaly CLONE_INTO_CGROUP is similar to regular fork + move to the > > target cgroup after the child gets executed. So in principle there > > shouldn't be any big difference. Except that the move has to be explicit > > and the the child has to have enough privileges to move itself. I am not > > Yeap, they're supposed to be the same operations. We've never clearly > defined how the accounting gets split across moves because 1. it's > inherently blurry and difficult 2. doesn't make any practical difference for > the recommended and vast majority usage pattern which uses migration to seed > the new cgroup. CLONE_INTO_CGROUP doesn't change any of that. > > > completely sure about CLONE_INTO_CGROUP model though. According to man > > clone(2) it seems that O_RDONLY for the target cgroup directory is > > sufficient. That seems much more relaxed IIUC and it would allow to fork > > into a different cgroup while keeping a lot of resources in the parent's > > proper. > > If the man page is documenting that, it's wrong. cgroup_css_set_fork() has > an explicit cgroup_may_write() test on the destination cgroup. > CLONE_INTO_CGROUP should follow exactly the same rules as regular > migrations. Indeed! The O_RDONLY mention on the manpage doesn't make sense but it is explained that the semantics are exactly the same for moving via the filesystem: "In order to place the child process in a different cgroup, the caller specifies CLONE_INTO_CGROUP in cl_args.flags and passes a file descriptor that refers to a version 2 cgroup in the cl_args.cgroup field. (This file descriptor can be obtained by opening a cgroup v2 directory using either the O_RDONLY or the O_PATH flag.) Note that all of the usual restrictions (described in cgroups(7)) on placing a process into a version 2 cgroup apply." Christian