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