From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id DB28B1396D0 for ; Thu, 14 Sep 2017 15:57:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 45A291FC0AF; Thu, 14 Sep 2017 15:57:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 222621FC0AF for ; Thu, 14 Sep 2017 15:57:26 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 26CA133BE19 for ; Thu, 14 Sep 2017 15:57:25 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8DE1E907E for ; Thu, 14 Sep 2017 15:57:21 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1505403578.6d7713a758b7e78f05e6a3cc101f862d28d778ab.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: / X-VCS-Repository: proj/openrc X-VCS-Files: guide.md X-VCS-Directories: / X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 6d7713a758b7e78f05e6a3cc101f862d28d778ab X-VCS-Branch: master Date: Thu, 14 Sep 2017 15:57:21 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 8efc259c-2424-4790-aafb-738ffb5c72a9 X-Archives-Hash: 7e87a8111aee3701c823ef65eb796ab2 commit: 6d7713a758b7e78f05e6a3cc101f862d28d778ab Author: William Hubbs gmail com> AuthorDate: Thu Sep 14 15:39:38 2017 +0000 Commit: William Hubbs gentoo org> CommitDate: Thu Sep 14 15:39:38 2017 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=6d7713a7 guide.md: clarify cgroups documentation Update the documentation to reflect cgroups version 2 support. Also, add a section on dealing with orphaned service processes. This fixes #94. guide.md | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/guide.md b/guide.md index 7aa23a63..e7e8f4b4 100644 --- a/guide.md +++ b/guide.md @@ -241,17 +241,36 @@ messages to a file), and a few others. # ulimit and CGroups -Setting `ulimit` and `nice` values per service can be done through the `rc_ulimit` -variable. +Setting `ulimit` and `nice` values per service can be done through the +`rc_ulimit` variable. -Under Linux, OpenRC can optionally use CGroups for process management. -By default each service script's processes are migrated to their own CGroup. +Under Linux, OpenRC can use cgroups for process management as well. Once +the kernel is configured appropriately, the `rc_cgroup_mode` setting in +/etc/rc.conf should be used to control whether cgroups version one,, +two, or both are used. The default is to use both if they are available. + +By changing certain settings in the service's `conf.d` file limits can be +enforced per service. These settings are documented in detail in the +default /etc/rc.conf under `LINUX CGROUPS RESOURCE MANAGEMENT`. + +# Dealing with Orphaned Processes + +It is possible to get into a state where there are orphaned processes +running which were part of a service. For example, if you are monitoring +a service with supervise-daemon and supervise-daemon dies for an unknown +reason. The way to deal with this will be different for each system. + +On Linux systems with cgroups enabled, the cgroup_cleanup command is +added to all services. You can run it manually, when the service is +stopped, by using: + +``` +# rc-service someservice cgroup_cleanup +``` + +The `rc_cgroup_cleanup` setting can be changed to yes to make this +happen automatically when the service is stopped. -By changing certain values in the `conf.d` file limits can be enforced per -service. It is easy to find orphan processes of a service that persist after -`stop()`, but by default these will NOT be terminated. -To change this add `rc_cgroup_cleanup="yes"` in the `conf.d` files for services -where you desire this functionality. # Caching