From: Wu Fengguang <fengguang.wu@intel.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>,
Andi Kleen <andi@firstfloor.org>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Rik van Riel <riel@redhat.com>, Mel Gorman <mel@csn.ul.ie>,
"lizf@cn.fujitsu.com" <lizf@cn.fujitsu.com>,
"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
"menage@google.com" <menage@google.com>,
linux-mm <linux-mm@kvack.org>
Subject: Re: [RFC][PATCH 0/4] memcg: add support for hwpoison testing
Date: Tue, 1 Sep 2009 16:55:49 +0800 [thread overview]
Message-ID: <20090901085549.GA4454@localhost> (raw)
In-Reply-To: <20090901161228.9fb33234.kamezawa.hiroyu@jp.fujitsu.com>
On Tue, Sep 01, 2009 at 03:12:28PM +0800, KAMEZAWA Hiroyuki wrote:
> On Tue, 1 Sep 2009 14:46:52 +0800
> Wu Fengguang <fengguang.wu@intel.com> wrote:
>
> > On Tue, Sep 01, 2009 at 10:32:14AM +0800, KAMEZAWA Hiroyuki wrote:
> > > On Tue, 1 Sep 2009 10:25:14 +0800
> > > Wu Fengguang <fengguang.wu@intel.com> wrote:
> > > > > 4. I can't understand why you need this. I wonder you can get pfn via
> > > > > /proc/<pid>/????. And this may insert HWPOISON to page-cache of shared
> > > > > library and "unexpected" process will be poisoned.
> > > >
> > > > Sorry I should have explained this. It's mainly for correctness.
> > > > When a user space tool queries the task PFNs in /proc/pid/pagemap and
> > > > then send to /debug/hwpoison/corrupt-pfn, there is a racy window that
> > > > the page could be reclaimed and allocated by some one else. It would
> > > > be awkward to try to pin the pages in user space. So we need the
> > > > guarantees provided by /debug/hwpoison/corrupt-filter-memcg, which
> > > > will be checked inside the page lock with elevated reference count.
> > > >
> > >
> > > memcg never holds refcnt for a page and the kernel::vmscan.c can reclaim
> > > any pages under memcg whithout checking anything related to memcg.
> > > *And*, your code has no "pin" code.
> > > This patch sed does no jobs for your concern.
> >
> > We grabbed page here, which is not in the scope of this patchset:
> >
> > static int try_memory_failure(unsigned long pfn)
> > {
> > struct page *p;
> > int res = -EINVAL;
> >
> > if (!pfn_valid(pfn))
> > return res;
> >
> > p = pfn_to_page(pfn);
> > if (!get_page_unless_zero(compound_head(p)))
> > return res;
> >
> > lock_page_nosync(compound_head(p));
> >
> > if (hwpoison_filter(p))
> > goto out;
> >
> > res = __memory_failure(pfn, 18,
> > MEMORY_FAILURE_FLAG_COUNTED |
> > MEMORY_FAILURE_FLAG_LOCKED);
> > out:
> > unlock_page(p);
> > return res;
> > }
>
> Hmm. maybe off-topic but why lock_page() is necessary ?
Because we also have filter for testing page flags, which requires
lock_page() to be correct.
>
> > > I recommend you to add
> > > /debug/hwpoizon/pin-pfn
> > >
> > > Then,
> > > echo pfn > /debug/hwpoizon/pin-pfn
> > > # add pfn for hwpoison debug's watch list. and elevate refcnt
> > > check 'pfn' is still used.
> > > echo pfn > /debug/hwpoison/corrupt-pfn
> > > # check 'watch list' and make it corrupt and release refcnt.
> > > or some.
> >
> > Looks like a good alternative. At least no more memcg dependency..
> >
>
> My point is that memcg can show 'owner' of pages but the page may
> be shared with something important task _and_ if a task is migrated,
> its pages' memcg information is not updated now. Then, you can kill
> a task which is not in memcg.
Ah thanks! I'm not aware of that tricky fact, and it does make a
very good reason not to use memcg, although I guess locked page won't
be migrated.
> Then, I don't recommend to use memcg. I think you'll see too much
> pitfalls.
Thanks,
Fengguang
--
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-09-01 8:56 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 ` [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 [this message]
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=20090901085549.GA4454@localhost \
--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).