From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756390AbYKKMe0 (ORCPT ); Tue, 11 Nov 2008 07:34:26 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755854AbYKKMd7 (ORCPT ); Tue, 11 Nov 2008 07:33:59 -0500 Received: from e5.ny.us.ibm.com ([32.97.182.145]:44295 "EHLO e5.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755765AbYKKMd6 (ORCPT ); Tue, 11 Nov 2008 07:33:58 -0500 From: Balbir Singh To: linux-mm@kvack.org Cc: YAMAMOTO Takashi , Paul Menage , lizf@cn.fujitsu.com, linux-kernel@vger.kernel.org, Nick Piggin , David Rientjes , Pavel Emelianov , Dhaval Giani , Balbir Singh , Andrew Morton , KAMEZAWA Hiroyuki Date: Tue, 11 Nov 2008 18:03:38 +0530 Message-Id: <20081111123338.6566.33066.sendpatchset@balbir-laptop> In-Reply-To: <20081111123314.6566.54133.sendpatchset@balbir-laptop> References: <20081111123314.6566.54133.sendpatchset@balbir-laptop> Subject: [RFC][mm] [PATCH 1/4] Memory cgroup hierarchy documentation (v3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Documentation updates for hierarchy support Signed-off-by: Balbir Singh --- Documentation/controllers/memory.txt | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff -puN Documentation/controllers/memory.txt~memcg-hierarchy-documentation Documentation/controllers/memory.txt --- linux-2.6.28-rc2/Documentation/controllers/memory.txt~memcg-hierarchy-documentation 2008-11-11 17:51:54.000000000 +0530 +++ linux-2.6.28-rc2-balbir/Documentation/controllers/memory.txt 2008-11-11 17:51:54.000000000 +0530 @@ -245,6 +245,43 @@ cgroup might have some charge associated tasks have migrated away from it. Such charges are automatically dropped at rmdir() if there are no tasks. +5. Hierarchy support + +The memory controller supports a deep hierarchy and hierarchical accounting. +The hierarchy is created by creating the appropriate cgroups in the +cgroup filesystem. Consider for example, the following cgroup filesystem +hierarchy + + root + / | \ + / | \ + a b c + | \ + | \ + d e + +In the diagram above, with hierarchical accounting enabled, all memory +usage of e, is accounted to its ancestors up until the root (i.e, c and root), +that has memory.use_hierarchy enabled. If one of the ancestors goes over its +limit, the reclaim algorithm reclaims from the tasks in the ancestor and the +children of the ancestor. + +5.1 Enabling hierarchical accounting and reclaim + +The memory controller by default disables the hierarchy feature. Support +can be enabled by writing 1 to memory.use_hierarchy file of the root cgroup + +# echo 1 > memory.use_hierarchy + +The feature can be disabled by + +# echo 0 > memory.use_hierarchy + +NOTE1: Enabling/disabling will fail if the cgroup already has other +cgroups created below it. + +NOTE2: This feature can be enabled/disabled per subtree. + 5. TODO 1. Add support for accounting huge pages (as a separate controller) _ -- Balbir