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 4/4] HWPOISON: memory cgroup based hwpoison injection filtering
Date: Mon, 31 Aug 2009 18:26:44 +0800 [thread overview]
Message-ID: <20090831104217.039999677@intel.com> (raw)
In-Reply-To: 20090831102640.092092954@intel.com
[-- Attachment #1: hwpoison-filter-cgroup-pages.patch --]
[-- Type: text/plain, Size: 1917 bytes --]
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
mm/hwpoison-inject.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
--- linux-mm.orig/mm/hwpoison-inject.c 2009-08-30 18:18:41.000000000 +0800
+++ linux-mm/mm/hwpoison-inject.c 2009-08-30 18:24:33.000000000 +0800
@@ -5,10 +5,13 @@
#include <linux/mm.h>
#include <linux/bootmem.h>
#include <linux/pagemap.h>
+#include <linux/page_cgroup.h>
+#include <linux/cgroup.h>
#include "internal.h"
static struct dentry *hwpoison_dir;
+static u32 hwpoison_filter_memcg;
static u32 hwpoison_filter_dev_major = ~0U;
static u32 hwpoison_filter_dev_minor = ~0U;
static u64 hwpoison_filter_flags_mask;
@@ -53,8 +56,37 @@ static int hwpoison_filter_dev(struct pa
return 0;
}
+static int hwpoison_filter_cg(struct page *p)
+{
+ struct mem_cgroup *mem;
+ struct cgroup_subsys_state *css;
+ int ret;
+
+ if (!hwpoison_filter_memcg)
+ return 0;
+
+ mem = try_get_mem_cgroup_from_page(p);
+ if (!mem)
+ return -EINVAL;
+
+ css = mem_cgroup_css(mem);
+ if (!css)
+ return -EINVAL;
+
+ if (css_id(css) != hwpoison_filter_memcg)
+ ret = -EINVAL;
+ else
+ ret = 0;
+
+ css_put(css);
+ return ret;
+}
+
static int hwpoison_filter(struct page *p)
{
+ if (hwpoison_filter_cg(p))
+ return 1;
+
if (hwpoison_filter_dev(p))
return -EINVAL;
@@ -119,6 +151,11 @@ static int pfn_inject_init(void)
if (!dentry)
goto fail;
+ dentry = debugfs_create_u32("corrupt-filter-memcg", 0600,
+ hwpoison_dir, &hwpoison_filter_memcg);
+ if (!dentry)
+ goto fail;
+
dentry = debugfs_create_u32("corrupt-filter-dev-major", 0600,
hwpoison_dir, &hwpoison_filter_dev_major);
if (!dentry)
--
--
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:[~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 ` [RFC][PATCH 1/4] memcg: show memory.id in cgroupfs Wu Fengguang
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 ` Wu Fengguang [this message]
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=20090831104217.039999677@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).