From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF484C43468 for ; Mon, 21 Sep 2020 14:44:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 585B9221EC for ; Mon, 21 Sep 2020 14:44:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 585B9221EC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ubuntu.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AC0DF900071; Mon, 21 Sep 2020 10:44:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A70AF900069; Mon, 21 Sep 2020 10:44:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9383E900071; Mon, 21 Sep 2020 10:44:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0149.hostedemail.com [216.40.44.149]) by kanga.kvack.org (Postfix) with ESMTP id 7E485900069 for ; Mon, 21 Sep 2020 10:44:04 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2C56A824999B for ; Mon, 21 Sep 2020 14:44:04 +0000 (UTC) X-FDA: 77287338408.04.news95_491840d27145 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 013518007635 for ; Mon, 21 Sep 2020 14:44:03 +0000 (UTC) X-HE-Tag: news95_491840d27145 X-Filterd-Recvd-Size: 4073 Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Mon, 21 Sep 2020 14:44:03 +0000 (UTC) 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> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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