Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1182165

[PATCH -mm v7 2/6] hwpoison: use page_cgroup_ino for filtering by memcg

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Vladimir Davydov <vdavydov@parallels.com>
Newsgroups linux.kernel
Subject [PATCH -mm v7 2/6] hwpoison: use page_cgroup_ino for filtering by memcg
Date Sat, 11 Jul 2015 16:50:02 +0200
Message-ID <pL4gi-4l9-29@gated-at.bofh.it> (permalink)
References <pL4gh-4l9-7@gated-at.bofh.it>
X-Original-To Andrew Morton <akpm@linux-foundation.org>
X-Mailer git-send-email 2.1.4
MIME-Version 1.0
Content-Type text/plain
X-Originating-IP [10.24.25.32]
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 79
Organization linux.* mail to news gateway
X-Original-Cc Andres Lagar-Cavilla <andreslc@google.com>, Minchan Kim <minchan@kernel.org>, Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>, Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@suse.cz>, Greg Thelen <gthelen@google.com>, Michel Lespinasse <walken@google.com>, David Rientjes <rientjes@google.com>, Pavel Emelyanov <xemul@parallels.com>, Cyrill Gorcunov <gorcunov@openvz.org>, Jonathan Corbet <corbet@lwn.net>, <linux-api@vger.kernel.org>, <linux-doc@vger.kernel.org>, <linux-mm@kvack.org>, <cgroups@vger.kernel.org>, <linux-kernel@vger.kernel.org>
X-Original-Date Sat, 11 Jul 2015 17:48:07 +0300
X-Original-Message-ID <5c4d3594a5b0a79248fffae67ea677d54d06aacf.1436623799.git.vdavydov@parallels.com>
X-Original-References <cover.1436623799.git.vdavydov@parallels.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1182165

Show key headers only | View raw


Hwpoison allows to filter pages by memory cgroup ino. Currently, it
calls try_get_mem_cgroup_from_page to obtain the cgroup from a page and
then its ino using cgroup_ino, but now we have an apter method for that,
page_cgroup_ino, so use it instead.

Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
---
 mm/hwpoison-inject.c |  5 +----
 mm/memory-failure.c  | 16 ++--------------
 2 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c
index bf73ac17dad4..5015679014c1 100644
--- a/mm/hwpoison-inject.c
+++ b/mm/hwpoison-inject.c
@@ -45,12 +45,9 @@ static int hwpoison_inject(void *data, u64 val)
 	/*
 	 * do a racy check with elevated page count, to make sure PG_hwpoison
 	 * will only be set for the targeted owner (or on a free page).
-	 * We temporarily take page lock for try_get_mem_cgroup_from_page().
 	 * memory_failure() will redo the check reliably inside page lock.
 	 */
-	lock_page(hpage);
 	err = hwpoison_filter(hpage);
-	unlock_page(hpage);
 	if (err)
 		goto put_out;
 
@@ -126,7 +123,7 @@ static int pfn_inject_init(void)
 	if (!dentry)
 		goto fail;
 
-#ifdef CONFIG_MEMCG_SWAP
+#ifdef CONFIG_MEMCG
 	dentry = debugfs_create_u64("corrupt-filter-memcg", 0600,
 				    hwpoison_dir, &hwpoison_filter_memcg);
 	if (!dentry)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 1cf7f2988422..97005396a507 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -130,27 +130,15 @@ static int hwpoison_filter_flags(struct page *p)
  * can only guarantee that the page either belongs to the memcg tasks, or is
  * a freed page.
  */
-#ifdef	CONFIG_MEMCG_SWAP
+#ifdef CONFIG_MEMCG
 u64 hwpoison_filter_memcg;
 EXPORT_SYMBOL_GPL(hwpoison_filter_memcg);
 static int hwpoison_filter_task(struct page *p)
 {
-	struct mem_cgroup *mem;
-	struct cgroup_subsys_state *css;
-	unsigned long ino;
-
 	if (!hwpoison_filter_memcg)
 		return 0;
 
-	mem = try_get_mem_cgroup_from_page(p);
-	if (!mem)
-		return -EINVAL;
-
-	css = mem_cgroup_css(mem);
-	ino = cgroup_ino(css->cgroup);
-	css_put(css);
-
-	if (ino != hwpoison_filter_memcg)
+	if (page_cgroup_ino(p) != hwpoison_filter_memcg)
 		return -EINVAL;
 
 	return 0;
-- 
2.1.4

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

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH -mm v7 0/6] idle memory tracking Vladimir Davydov <vdavydov@parallels.com> - 2015-07-11 16:50 +0200
  [PATCH -mm v7 5/6] proc: add kpageidle file Vladimir Davydov <vdavydov@parallels.com> - 2015-07-11 16:50 +0200
    Re: [PATCH -mm v7 5/6] proc: add kpageidle file Andres Lagar-Cavilla <andreslc@google.com> - 2015-07-14 22:30 +0200
  [PATCH -mm v7 3/6] memcg: zap try_get_mem_cgroup_from_page Vladimir Davydov <vdavydov@parallels.com> - 2015-07-11 16:50 +0200
  [PATCH -mm v7 2/6] hwpoison: use page_cgroup_ino for filtering by memcg Vladimir Davydov <vdavydov@parallels.com> - 2015-07-11 16:50 +0200
  [PATCH -mm v7 6/6] proc: export idle flag via kpageflags Vladimir Davydov <vdavydov@parallels.com> - 2015-07-11 16:50 +0200
  [PATCH -mm v7 4/6] proc: add kpagecgroup file Vladimir Davydov <vdavydov@parallels.com> - 2015-07-11 16:50 +0200
  [PATCH -mm v7 1/6] memcg: add page_cgroup_ino helper Vladimir Davydov <vdavydov@parallels.com> - 2015-07-11 17:00 +0200

csiph-web