From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>,
Linux Containers <containers@lists.osdl.org>,
linux-mm@kvack.org
Cc: Balbir Singh <balbir@in.ibm.com>, Pavel Emelianov <xemul@sw.ru>,
Paul Menage <menage@google.com>, Kirill Korotaev <dev@sw.ru>,
devel@openvz.org, Andrew Morton <akpm@linux-foundation.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Herbert Poetzl <herbert@13thfloor.at>,
Roy Huang <royhuang9@gmail.com>, Aubrey Li <aubreylee@gmail.com>
Subject: [RFC][PATCH 1/3] Containers: Pagecache accounting and control subsystem (v3)
Date: Wed, 23 May 2007 20:20:54 +0530 [thread overview]
Message-ID: <465454CE.2020703@linux.vnet.ibm.com> (raw)
In-Reply-To: <46545459.2090804@linux.vnet.ibm.com>
Pagecache controller setup
--------------------------
This patch basically adds user interface files in container fs
similar to the rss control files.
pagecache_usage, pagecache_limit and pagecache_failcnt are added
to each container. All units are 'pages' as in rss controller.
pagecache usage is all file backed pages used by the container
which includes swapcache as well.
Separate res_counter for pagecache has been added.
Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
---
mm/rss_container.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
--- linux-2.6.20.orig/mm/rss_container.c
+++ linux-2.6.20/mm/rss_container.c
@@ -16,6 +16,7 @@
struct rss_container {
struct res_counter res;
+ struct res_counter pagecache_res;
struct list_head inactive_list;
struct list_head active_list;
atomic_t rss_reclaimed;
@@ -266,6 +267,7 @@ static int rss_create(struct container_s
return -ENOMEM;
res_counter_init(&rss->res);
+ res_counter_init(&rss->pagecache_res);
INIT_LIST_HEAD(&rss->inactive_list);
INIT_LIST_HEAD(&rss->active_list);
rss_container_attach(rss, cont);
@@ -308,6 +310,21 @@ static ssize_t rss_read_reclaimed(struct
ppos, buf, s - buf);
}
+static ssize_t pagecache_read(struct container *cont, struct cftype *cft,
+ struct file *file, char __user *userbuf,
+ size_t nbytes, loff_t *ppos)
+{
+ return res_counter_read(&rss_from_cont(cont)->pagecache_res,
+ cft->private, userbuf, nbytes, ppos);
+}
+
+static ssize_t pagecache_write(struct container *cont, struct cftype *cft,
+ struct file *file, const char __user *userbuf,
+ size_t nbytes, loff_t *ppos)
+{
+ return res_counter_write(&rss_from_cont(cont)->pagecache_res,
+ cft->private, userbuf, nbytes, ppos);
+}
static struct cftype rss_usage = {
.name = "rss_usage",
@@ -333,6 +350,25 @@ static struct cftype rss_reclaimed = {
.read = rss_read_reclaimed,
};
+static struct cftype pagecache_usage = {
+ .name = "pagecache_usage",
+ .private = RES_USAGE,
+ .read = pagecache_read,
+};
+
+static struct cftype pagecache_limit = {
+ .name = "pagecache_limit",
+ .private = RES_LIMIT,
+ .read = pagecache_read,
+ .write = pagecache_write,
+};
+
+static struct cftype pagecache_failcnt = {
+ .name = "pagecache_failcnt",
+ .private = RES_FAILCNT,
+ .read = pagecache_read,
+};
+
static int rss_populate(struct container_subsys *ss,
struct container *cont)
{
@@ -346,6 +382,12 @@ static int rss_populate(struct container
return rc;
if ((rc = container_add_file(cont, &rss_reclaimed)) < 0)
return rc;
+ if ((rc = container_add_file(cont, &pagecache_usage)) < 0)
+ return rc;
+ if ((rc = container_add_file(cont, &pagecache_failcnt)) < 0)
+ return rc;
+ if ((rc = container_add_file(cont, &pagecache_limit)) < 0)
+ return rc;
return 0;
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2007-05-23 15:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-23 14:48 [RFC][PATCH 0/3] " Vaidyanathan Srinivasan
2007-05-23 14:50 ` Vaidyanathan Srinivasan [this message]
2007-05-23 14:52 ` [RFC][PATCH 2/3] " Vaidyanathan Srinivasan
2007-05-23 14:53 ` [RFC][PATCH 3/3] " Vaidyanathan Srinivasan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=465454CE.2020703@linux.vnet.ibm.com \
--to=svaidy@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=aubreylee@gmail.com \
--cc=balbir@in.ibm.com \
--cc=containers@lists.osdl.org \
--cc=dev@sw.ru \
--cc=devel@openvz.org \
--cc=ebiederm@xmission.com \
--cc=herbert@13thfloor.at \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=menage@google.com \
--cc=royhuang9@gmail.com \
--cc=xemul@sw.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox