linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	Wu Fengguang <fengguang.wu@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Rik van Riel <riel@redhat.com>, Mel Gorman <mel@csn.ul.ie>,
	lizf@cn.fujitsu.com, nishimura@mxp.nes.nec.co.jp,
	menage@google.com, linux-mm <linux-mm@kvack.org>
Subject: [RFC][PATCH 1/4] memcg: show memory.id in cgroupfs
Date: Mon, 31 Aug 2009 18:26:41 +0800	[thread overview]
Message-ID: <20090831104216.648065078@intel.com> (raw)
In-Reply-To: 20090831102640.092092954@intel.com

[-- Attachment #1: memcg-show-id.patch --]
[-- Type: text/plain, Size: 1514 bytes --]

The hwpoison test suite need to selectively inject hwpoison to some
targeted task pages, and must not kill important system processes
such as init.

The memory cgroup serves this purpose well. We can put the target
processes under the control of a memory cgroup, tell the hwpoison
injection code the id of that memory cgroup so that it will only
poison pages associated with it.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 mm/memcontrol.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- linux-mm.orig/mm/memcontrol.c	2009-08-31 15:27:34.000000000 +0800
+++ linux-mm/mm/memcontrol.c	2009-08-31 15:41:50.000000000 +0800
@@ -2510,6 +2510,11 @@ mem_cgroup_get_recursive_idx_stat(struct
 	*val = d.val;
 }
 
+static u64 mem_cgroup_id_read(struct cgroup *cont, struct cftype *cft)
+{
+	return css_id(cgroup_subsys_state(cont, mem_cgroup_subsys_id));
+}
+
 static u64 mem_cgroup_read(struct cgroup *cont, struct cftype *cft)
 {
 	struct mem_cgroup *mem = mem_cgroup_from_cont(cont);
@@ -2842,6 +2847,10 @@ static int mem_cgroup_swappiness_write(s
 
 static struct cftype mem_cgroup_files[] = {
 	{
+		.name = "id",
+		.read_u64 = mem_cgroup_id_read,
+	},
+	{
 		.name = "usage_in_bytes",
 		.private = MEMFILE_PRIVATE(_MEM, RES_USAGE),
 		.read_u64 = mem_cgroup_read,

-- 

--
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>

  reply	other threads:[~2009-08-31 10:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-31 10:26 [RFC][PATCH 0/4] memcg: add support for hwpoison testing Wu Fengguang
2009-08-31 10:26 ` Wu Fengguang [this message]
2009-08-31 10:26 ` [RFC][PATCH 2/4] memcg: rename and export try_get_mem_cgroup_from_page() Wu Fengguang
2009-08-31 10:26 ` [RFC][PATCH 3/4] memcg: add accessor to mem_cgroup.css Wu Fengguang
2009-08-31 10:26 ` [RFC][PATCH 4/4] HWPOISON: memory cgroup based hwpoison injection filtering Wu Fengguang
2009-08-31 12:49 ` [RFC][PATCH 0/4] memcg: add support for hwpoison testing Balbir Singh
2009-08-31 12:59   ` Wu Fengguang
2009-08-31 23:46 ` KAMEZAWA Hiroyuki
2009-09-01  2:25   ` Wu Fengguang
2009-09-01  2:32     ` KAMEZAWA Hiroyuki
2009-09-01  6:46       ` Wu Fengguang
2009-09-01  7:12         ` KAMEZAWA Hiroyuki
2009-09-01  8:55           ` Wu Fengguang
2009-09-01 16:31             ` Balbir Singh
2009-09-02  2:47               ` Wu Fengguang

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=20090831104216.648065078@intel.com \
    --to=fengguang.wu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mel@csn.ul.ie \
    --cc=menage@google.com \
    --cc=nishimura@mxp.nes.nec.co.jp \
    --cc=riel@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).