Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751907AbYKPILP (ORCPT ); Sun, 16 Nov 2008 03:11:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752001AbYKPIKs (ORCPT ); Sun, 16 Nov 2008 03:10:48 -0500 Received: from e28smtp03.in.ibm.com ([59.145.155.3]:37572 "EHLO e28smtp03.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751919AbYKPIKq (ORCPT ); Sun, 16 Nov 2008 03:10:46 -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: Sun, 16 Nov 2008 13:40:40 +0530 Message-Id: <20081116081040.25166.65142.sendpatchset@balbir-laptop> In-Reply-To: <20081116081034.25166.7586.sendpatchset@balbir-laptop> References: <20081116081034.25166.7586.sendpatchset@balbir-laptop> Subject: [mm] [PATCH 1/4] Memory cgroup hierarchy documentation (v4) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2353 Lines: 67 Documentation updates for hierarchy support Signed-off-by: Balbir Singh --- Documentation/controllers/memory.txt | 38 ++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff -puN Documentation/controllers/memory.txt~memcg-hierarchy-documentation Documentation/controllers/memory.txt --- linux-2.6.28-rc4/Documentation/controllers/memory.txt~memcg-hierarchy-documentation 2008-11-16 13:14:39.000000000 +0530 +++ linux-2.6.28-rc4-balbir/Documentation/controllers/memory.txt 2008-11-16 13:14:39.000000000 +0530 @@ -289,8 +289,44 @@ will be charged as a new owner of it. Because rmdir() moves all pages to parent, some out-of-use page caches can be moved to the parent. If you want to avoid that, force_empty will be useful. +6. Hierarchy support -6. TODO +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. + +6.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. + +7. TODO 1. Add support for accounting huge pages (as a separate controller) 2. Make per-cgroup scanner reclaim not-shared pages first _ -- Balbir -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/