linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: Wu Fengguang <fengguang.wu@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Christoph Lameter <cl@linux-foundation.org>,
	Mel Gorman <mel@csn.ul.ie>,
	Jun'ichi Nomura <j-nomura@ce.jp.nec.com>,
	linux-mm <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 7/8] HWPOISON, hugetlb: fix unpoison for hugepage
Date: Thu, 26 Aug 2010 17:26:16 +0900	[thread overview]
Message-ID: <20100826082616.GX21389@spritzera.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <20100825025432.GA15129@localhost>

On Wed, Aug 25, 2010 at 10:54:32AM +0800, Wu Fengguang wrote:
> On Wed, Aug 25, 2010 at 07:55:26AM +0800, Naoya Horiguchi wrote:
> > Currently unpoisoning hugepages doesn't work because it's not enough
> > to just clear PG_HWPoison bits and we need to link the hugepage
> > to be unpoisoned back to the free hugepage list.
> > To do this, we get and put hwpoisoned hugepage whose refcount is 0.
> > 
> > Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> > Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
> > ---
> >  mm/memory-failure.c |   16 +++++++++++++---
> >  1 files changed, 13 insertions(+), 3 deletions(-)
> > 
> > diff --git v2.6.36-rc2/mm/memory-failure.c v2.6.36-rc2/mm/memory-failure.c
> > index 60178d2..ab36690 100644
> > --- v2.6.36-rc2/mm/memory-failure.c
> > +++ v2.6.36-rc2/mm/memory-failure.c
> > @@ -1154,9 +1154,19 @@ int unpoison_memory(unsigned long pfn)
> >  	nr_pages = 1 << compound_order(page);
> >  
> >  	if (!get_page_unless_zero(page)) {
> > -		if (TestClearPageHWPoison(p))
> > +		/* The page to be unpoisoned was free one when hwpoisoned */
> > +		if (TestClearPageHWPoison(page))
> >  			atomic_long_sub(nr_pages, &mce_bad_pages);
> >  		pr_debug("MCE: Software-unpoisoned free page %#lx\n", pfn);
> > +		if (PageHuge(page)) {
> > +			/*
> > +			 * To unpoison free hugepage, we get and put it
> > +			 * to move it back to the free list.
> > +			 */
> > +			get_page(page);
> > +			clear_page_hwpoison_huge_page(page);
> > +			put_page(page);
> > +		}
> >  		return 0;
> >  	}
> 
> It's racy in free huge page detection.
> 
> alloc_huge_page() does not increase page refcount inside hugetlb_lock,
> the alloc_huge_page()=>alloc_buddy_huge_page() path even drops the
> lock temporarily! Then we never know reliably if a huge page is really
> free.

I agree.

> Here is a scratched fix. It is totally untested. Just want to notice
> you that with this patch, the huge page unpoisoning should go easier.

Great.
I adjusted this patch to real hugetlb code and passed libhugetlbfs test.

Thanks,
Naoya

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

  reply	other threads:[~2010-08-26  8:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-24 23:55 [PATCH 0/8] Hugepage migration (v3) Naoya Horiguchi
2010-08-24 23:55 ` [PATCH 1/8] hugetlb: fix metadata corruption in hugetlb_fault() Naoya Horiguchi
2010-08-25  0:17   ` Wu Fengguang
2010-08-24 23:55 ` [PATCH 2/8] hugetlb: add allocate function for hugepage migration Naoya Horiguchi
2010-08-25  1:29   ` Wu Fengguang
2010-08-26  8:24     ` Naoya Horiguchi
2010-08-24 23:55 ` [PATCH 3/8] hugetlb: rename hugepage allocation functions Naoya Horiguchi
2010-08-25  1:21   ` Wu Fengguang
2010-08-26  8:25     ` Naoya Horiguchi
2010-08-24 23:55 ` [PATCH 4/8] hugetlb: redefine hugepage copy functions Naoya Horiguchi
2010-08-24 23:55 ` [PATCH 5/8] hugetlb: hugepage migration core Naoya Horiguchi
2010-08-24 23:55 ` [PATCH 6/8] HWPOISON, hugetlb: soft offlining for hugepage Naoya Horiguchi
2010-08-25  3:02   ` Wu Fengguang
2010-08-24 23:55 ` [PATCH 7/8] HWPOISON, hugetlb: fix unpoison " Naoya Horiguchi
2010-08-25  2:54   ` Wu Fengguang
2010-08-26  8:26     ` Naoya Horiguchi [this message]
2010-08-24 23:55 ` [PATCH 8/8] page-types.c: fix name of unpoison interface Naoya Horiguchi

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=20100826082616.GX21389@spritzera.linux.bs1.fc.nec.co.jp \
    --to=n-horiguchi@ah.jp.nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=cl@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    /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