From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1005863-garchives=archives.gentoo.org@lists.gentoo.org>
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 E296C1382C5
	for <garchives@archives.gentoo.org>; Mon, 26 Feb 2018 20:34:25 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id ABB53E0A70;
	Mon, 26 Feb 2018 20:34:24 +0000 (UTC)
Received: from smtp.gentoo.org (dev.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 8821EE0A70
	for <gentoo-commits@lists.gentoo.org>; Mon, 26 Feb 2018 20:34:24 +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 0A957335C38
	for <gentoo-commits@lists.gentoo.org>; Mon, 26 Feb 2018 20:34:23 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 319AC1ED
	for <gentoo-commits@lists.gentoo.org>; Mon, 26 Feb 2018 20:34:21 +0000 (UTC)
From: "William Hubbs" <williamh@gentoo.org>
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" <williamh@gentoo.org>
Message-ID: <1519677195.c6047f887a362cb8d96624fbd73484ca703acf53.williamh@OpenRC>
Subject: [gentoo-commits] proj/openrc:master commit in: init.d/, etc/
X-VCS-Repository: proj/openrc
X-VCS-Files: etc/rc.conf init.d/cgroups.in
X-VCS-Directories: init.d/ etc/
X-VCS-Committer: williamh
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: c6047f887a362cb8d96624fbd73484ca703acf53
X-VCS-Branch: master
Date: Mon, 26 Feb 2018 20:34:21 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: a468e2c1-c984-4fa9-bfbb-5f6d8452450d
X-Archives-Hash: bc41f802905639e1aaea33853042597e

commit:     c6047f887a362cb8d96624fbd73484ca703acf53
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Feb 26 20:33:15 2018 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Feb 26 20:33:15 2018 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=c6047f88

cgroups: add rc_cgroup_memory_use_hierarchy setting for cgroups v1

 etc/rc.conf       | 5 +++++
 init.d/cgroups.in | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/etc/rc.conf b/etc/rc.conf
index b7296d35..32c905d4 100644
--- a/etc/rc.conf
+++ b/etc/rc.conf
@@ -227,6 +227,11 @@ rc_tty_number=12
 # /sys/fs/cgroup in hybrid or legacy mode.
 #rc_controller_cgroups="YES"
 
+# The following setting turns on the memory.use_hierarchy setting in the
+# root memory cgroup for cgroups v1.
+# It must be set to yes in this file if you want this functionality.
+#rc_cggroup_memory_use_hierarchy="NO"
+
 # The following settings allow you to set up values for the cgroups version 1
 # controllers for your services.
 # They can be set in this file;, however, if you do this, the settings

diff --git a/init.d/cgroups.in b/init.d/cgroups.in
index 8ec91ef6..01f5dd48 100644
--- a/init.d/cgroups.in
+++ b/init.d/cgroups.in
@@ -57,6 +57,9 @@ cgroup1_controllers()
 				mkdir "/sys/fs/cgroup/${name}"
 				mount -n -t cgroup -o "${cgroup_opts},${name}" \
 					"${name}" "/sys/fs/cgroup/${name}"
+					yesno "${rc_cgroup_memory_use_hierarchy:-no}" &&
+					[ "${name}" = memory ] &&
+					echo 1 > /sys/fs/cgroup/memory/memory.use_hierarchy
 				;;
 		esac
 	done < /proc/cgroups