lkml.org 
[lkml]   [2009]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC][PATCH 1/4] memcg: show memory.id in cgroupfs
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,
--



\
 
 \ /
  Last update: 2009-08-31 12:47    [W:0.060 / U:12.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site