Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1005704imu; Tue, 20 Nov 2018 10:06:39 -0800 (PST) X-Google-Smtp-Source: AFSGD/XBb3Q1VMuwTmAwCcYBZVxaKSFNlvidoZsdoYjehc07SacO/uYrq0rrU3gthZNMuhUE3VlQ X-Received: by 2002:a63:4815:: with SMTP id v21mr2815609pga.308.1542737199374; Tue, 20 Nov 2018 10:06:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542737199; cv=none; d=google.com; s=arc-20160816; b=mNn4qIFpzJOIUrNF/WEVVvvO6iRhIoxZ5ZdymN5vg/6Si6XJ0SWEMIXAzG7vAQZfKi ZAHLukErNWgfoCRCs/R7whRiKT/pikMEbqR4vDchGGTxLM/emfCA7z4D8AUC9eZx2cHZ GD0NfSInBm9yNtBZnzfZC06MxgKDLiPy2Ofm+1H8Nk5v7V+VKdnNMcghAAE95u7hyrcS 1feRrqYoRhUCtYX4a0XHUAJXVfCelUH7GH4j/Vmi0iL1cRmmUStDXzhQTDkxE4SM58tu ImcOu5WiGopfT9CKz9qgxB0VPp9aGoDFyX2v/uK6uvZsjMuXi9GdohGgUE2lGn6Dk7wD je4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=zmg7IZQb2e4+oQ3equjLKA2Zz+SOtHWtOtd+1xksKWo=; b=UO4sf/hw+YWg6r6CYR+HQCWcnvPnezkdfxZw9wrki6W4hBzUMVtY9Fg2mmIJDSRlLi 8nkn02UabQRO4N9UHQ5qNqVqIrLij/10cAwiVaS+lDaXnpZK1nbPHHEOD/CLqJSlRQoR ca5j9G//u5v+103V0RrhDKtmAaYlUYd1NuKCaVdl4pk3AnYa+8bRDJRhD5/UL1sCx0N2 QVkq1/pi1LvpR/EgGLzi54GrvFthRp2f3g/at3utW39/0okCTqKuUH2ddKfN+vLu0D6z i69oz55iV+uZr1hqgOZ8NHpJs5Ro/vTehet4dD2p3Q1FnT8RQlhiKksuAGEA84UczBbW 6waw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r27si43195225pgl.494.2018.11.20.10.06.07; Tue, 20 Nov 2018 10:06:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730395AbeKUEWn (ORCPT + 99 others); Tue, 20 Nov 2018 23:22:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33612 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730248AbeKUEWm (ORCPT ); Tue, 20 Nov 2018 23:22:42 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B22E3082B43; Tue, 20 Nov 2018 17:52:20 +0000 (UTC) Received: from llong.com (ovpn-120-174.rdu2.redhat.com [10.10.120.174]) by smtp.corp.redhat.com (Postfix) with ESMTP id 28D98648B4; Tue, 20 Nov 2018 17:52:18 +0000 (UTC) From: Waiman Long To: Tejun Heo , Li Zefan , Johannes Weiner , Peter Zijlstra , Ingo Molnar , Jonathan Corbet Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Roman Gushchin , Jens Axboe , Andrew Morton , Dennis Zhou , Shakeel Butt , Waiman Long Subject: [PATCH v4 5/5] cgroup: Document bypass mode Date: Tue, 20 Nov 2018 12:51:29 -0500 Message-Id: <1542736289-31338-6-git-send-email-longman@redhat.com> In-Reply-To: <1542736289-31338-1-git-send-email-longman@redhat.com> References: <1542736289-31338-1-git-send-email-longman@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 20 Nov 2018 17:52:20 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cgroup-v2.rst file is updated to document the new bypass mode. Signed-off-by: Waiman Long --- Documentation/admin-guide/cgroup-v2.rst | 66 ++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst index 07e0613..17e6584 100644 --- a/Documentation/admin-guide/cgroup-v2.rst +++ b/Documentation/admin-guide/cgroup-v2.rst @@ -372,9 +372,16 @@ disabled by writing to the "cgroup.subtree_control" file:: # echo "+cpu +memory -io" > cgroup.subtree_control -Only controllers which are listed in "cgroup.controllers" can be -enabled. When multiple operations are specified as above, either they -all succeed or fail. If multiple operations on the same controller +The prefixes '+', '-' and '#' are used to enable, disable or put +a controller in the bypass mode respectively. In the bypass mode, +a controller is disabled in a cgroup, but it can be enabled again in +its child cgroups as it will still be listed in "cgroup.controllers". +Bypass mode can only be used on bypassable controllers. Currently, +only the cpu controller is bypassable. + +Only controllers which are listed in "cgroup.controllers" can be enabled +or bypassed. When multiple operations are specified as above, either +they all succeed or fail. If multiple operations on the same controller are specified, the last one is effective. Enabling a controller in a cgroup indicates that the distribution of @@ -399,6 +406,20 @@ prefixed controller interface files from C and D. This means that the controller interface files - anything which doesn't start with "cgroup." are owned by the parent rather than the cgroup itself. +Once a bypassable controller is put into bypass mode in +"cgroup.subtree_control", that controller can optionally be enabled +again in child cgroups by writing the controller name with the '+ prefix +into "cgroup.controllers". Writing the controller name with the '#' +prefix into "cgroup.controllers" resets the state back to bypass mode. +The state of a bypassable controller cannot be changed anymore if it +is enabled or bypassed in its "cgroup.subtree_control". + +The use of bypass mode thus allows a cgroup parent to have the ability +to selectively enable a bypassable controller in a subset of its child +cgroups instead of in either all or none of them. In other words, a +bypassable can be enabled only on the cgroups that actually need it, +if desired. + Top-down Constraint ~~~~~~~~~~~~~~~~~~~ @@ -406,10 +427,11 @@ Top-down Constraint Resources are distributed top-down and a cgroup can further distribute a resource only if the resource has been distributed to it from the parent. This means that all non-root "cgroup.subtree_control" files -can only contain controllers which are enabled in the parent's -"cgroup.subtree_control" file. A controller can be enabled only if -the parent has the controller enabled and a controller can't be -disabled if one or more children have it enabled. +can only contain controllers which are enabled or bypassed in the +parent's "cgroup.subtree_control" file. A controller can be enabled +or bypassed only if the parent has the controller enabled or bypassed +and the state of a controller can't be changed if one or more children +have it enabled or bypassed. No Internal Process Constraint @@ -834,11 +856,18 @@ All cgroup core files are prefixed with "cgroup." should be granted along with the containing directory. cgroup.controllers - A read-only space separated values file which exists on all + A read-write space separated values file which exists on all cgroups. It shows space separated list of all controllers available to - the cgroup. The controllers are not ordered. + the cgroup. Controller names with '#' prefix are in bypass mode. + The controllers are not ordered. + + When a controller is set into bypass mode in its parent's + "cgroup.subtree_control", its name prefixed with '+' or '#' + can be written to enable it or reset it back to bypass mode + respectively. Controllers not in bypass mode are not allowed + to be written. cgroup.subtree_control A read-write space separated values file which exists on all @@ -848,12 +877,12 @@ All cgroup core files are prefixed with "cgroup." which are enabled to control resource distribution from the cgroup to its children. - Space separated list of controllers prefixed with '+' or '-' - can be written to enable or disable controllers. A controller - name prefixed with '+' enables the controller and '-' - disables. If a controller appears more than once on the list, - the last one is effective. When multiple enable and disable - operations are specified, either all succeed or all fail. + Space separated list of controllers prefixed with '+', '-' or + '#' can be written to enable, disable or bypass controllers + respectively. If a controller appears more than once on + the list, the last one is effective. When multiple enable, + disable or bypass operations are specified, either all succeed + or all fail. cgroup.events A read-only flat-keyed file which exists on non-root cgroups. @@ -904,17 +933,18 @@ Controllers CPU --- -The "cpu" controllers regulates distribution of CPU cycles. This +The "cpu" controller regulates distribution of CPU cycles. This controller implements weight and absolute bandwidth limit models for normal scheduling policy and absolute bandwidth allocation model for -realtime scheduling policy. +realtime scheduling policy. The cpu controller is bypassable. WARNING: cgroup2 doesn't yet support control of realtime processes and the cpu controller can only be enabled when all RT processes are in the root cgroup. Be aware that system management software may already have placed RT processes into nonroot cgroups during the system boot process, and these processes may need to be moved to the root cgroup -before the cpu controller can be enabled. +before the cpu controller can be enabled unless bypass mode is used +in those non-root cgroups. CPU Interface Files -- 1.8.3.1