From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751415AbdGQU4i (ORCPT ); Mon, 17 Jul 2017 16:56:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57274 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbdGQU4f (ORCPT ); Mon, 17 Jul 2017 16:56:35 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AE2367A162 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=longman@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AE2367A162 Subject: Re: [PATCH 5/6] cgroup: implement cgroup v2 thread support To: Peter Zijlstra , Tejun Heo Cc: lizefan@huawei.com, hannes@cmpxchg.org, mingo@redhat.com, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, pjt@google.com, luto@amacapital.net, efault@gmx.de, torvalds@linux-foundation.org, guro@fb.com References: <20170717020721.3612468-1-tj@kernel.org> <20170717020721.3612468-6-tj@kernel.org> <20170717141409.sqafufjupsiffnri@hirez.programming.kicks-ass.net> From: Waiman Long Organization: Red Hat Message-ID: <825f2eaa-568a-a156-f04d-9235b20e2614@redhat.com> Date: Mon, 17 Jul 2017 16:56:32 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20170717141409.sqafufjupsiffnri@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 17 Jul 2017 20:56:35 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/17/2017 10:14 AM, Peter Zijlstra wrote: > On Sun, Jul 16, 2017 at 10:07:20PM -0400, Tejun Heo wrote: >> v4: - Updated to marking each cgroup threaded as suggested by PeterZ. >> >> +On creation, a cgroup is always a domain cgroup and can be made >> +threaded by writing "threaded" to the "cgroup.type" file. The >> +operation is single direction:: >> + >> + # echo threaded > cgroup.type >> + >> +Once threaded, the cgroup can't be made a domain again. To enable the >> +thread mode, the following conditions must be met. >> + >> +- As the cgroup will join the parent's resource domain. The parent >> + must either be a valid (threaded) domain or a threaded cgroup. >> + >> +- The cgroup must be empty. No enabled controllers, child cgroups or >> + processes. >> + >> +Topology-wise, a cgroup can be in an invalid state. Please consider >> +the following toplogy:: >> + >> + A (threaded domain) - B (threaded) - C (domain, just created) >> + >> +C is created as a domain but isn't connected to a parent which can >> +host child domains. C can't be used until it is turned into a >> +threaded cgroup. "cgroup.type" file will report "domain (invalid)" in >> +these cases. Operations which fail due to invalid topology use >> +EOPNOTSUPP as the errno. >> + >> +A domain cgroup is turned into a threaded domain when one of its child >> +cgroup becomes threaded or threaded controllers are enabled in the >> +"cgroup.subtree_control" file while there are processes in the cgroup. >> +A threaded domain reverts to a normal domain when the conditions >> +clear. > AFAICT this is not in fact what I suggested... :/ > > My proposal did not have that invalid state. It would simply refuse to > change the type from thread to domain in the case where the parent is > not a domain. > > Also, my proposal maintained the normal property inheritance rules. A > child cgroup's creation 'type' would be that of its parent and not > always be 'domain'. I agree with Peter on this. A new cgroup created under a threaded cgroup should always be threaded. I don't see a need for an intermediate invalid domain. Cheers, Longman