Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3210054pxk; Mon, 21 Sep 2020 07:58:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyncC1HiIx2jnZIDSxg3qgSAO7LwMnyS3TNw8w/Urq6vf71v1mYz+nIx0/pZLZCdXYBFtAg X-Received: by 2002:a17:906:e103:: with SMTP id gj3mr49312125ejb.153.1600700296918; Mon, 21 Sep 2020 07:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600700296; cv=none; d=google.com; s=arc-20160816; b=e4j6EyJTikp3HdTx+gs4AJXOQJ68k66V0+PghShlnMwwwtfY51seLNnmN7begvU9ld EqjCfwRIZshzdaSB0XWr26td9c5ok2dJ0HxoLuWzkpyn8iLc2MXyUQgpvcrbLJdL7PqT 3xsy2op4hDJzToH5fWIeBqiFmHVMbl+xmxMzSKaUA8GKt4Hz6FhxS1G/RGsJTX/0/jhP 8p/u03DawGjA8CDmm0oo8FYfiykykRi6lSi5skJFei2OwvYKbZ5pGV6+XN8OrU3dzYI6 ZtPYeQDuyI42uYuc3j/7u3TqEIFELBmeQXv447NUoaIb10990f68zMA5HbJOJN2sa158 xEDQ== 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=O2hxECJppMlsOR2rqIB/aFwu3KAj3eBm6+S3bkE+n+0=; b=pGXY5Dki2teoKNS35BWA7mTTExFssA67Q0WFOcSNp/Q8T10TLlF5gTwRpukpUsBIWy 9ycJuc4mMQkPjnloQlJXBIAinLwzKHrUeBwbZaDfTukWGl2d/G17zfyLURzPjD+VEZju xTO6YkFfK5QLX6o1rIp+xc9rmU0410l1bnCARKx1K0619hRk6tfplDrG+VXvhX74La3t NuM8nEMzwJ+rop0JdbnHLwx3rW/UM37nAvK+aCGFfSG5yj5pl1cPTsU8LVi25SwqWGY2 +hLtldRavcbNLB8a1mZhDucXgr46xM7Vq5lbYumYuHrbxO0qmrwoJc4zbdLMvngoOLuf klaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ChiaDsyG; 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 v19si8685217ejy.466.2020.09.21.07.57.52; Mon, 21 Sep 2020 07:58:16 -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=ChiaDsyG; 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 S1727408AbgIUOzk (ORCPT + 99 others); Mon, 21 Sep 2020 10:55:40 -0400 Received: from mx2.suse.de ([195.135.220.15]:36282 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbgIUOzk (ORCPT ); Mon, 21 Sep 2020 10:55:40 -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=1600700139; 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=O2hxECJppMlsOR2rqIB/aFwu3KAj3eBm6+S3bkE+n+0=; b=ChiaDsyG2JCiW3nPTGEDMOmMFYctkjQ7C7fJA0n81XPyutMP/5Hm+5l1wpG7KMrrGPGRGr 7TT7HNu7cp9f97b0PAgha7svyDoDSpRqQ7x7v7nEiigkz+LhsEd/8fEtsc2iZLcAD64Rj6 cfF0g/1SYGhAKH3N1WXSYNpWPpQ7boM= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id F13CDABAD; Mon, 21 Sep 2020 14:56:14 +0000 (UTC) Date: Mon, 21 Sep 2020 16:55:37 +0200 From: Michal Hocko To: Christian Brauner Cc: Tejun Heo , 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: <20200921145537.GM12990@dhcp22.suse.cz> References: <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> <20200921144355.mrzc66lina3dkfjq@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200921144355.mrzc66lina3dkfjq@wittgenstein> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 21-09-20 16:43:55, Christian Brauner wrote: > 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: OK, if the semantic is the same as for the task migration then I do not see any (new) problems. Care to point me where the actual check is enforced? For the migration you need a write access to cgroup.procs but if the API expects directory fd then I am not sure how that would expose the same behavior. -- Michal Hocko SUSE Labs