linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Qian Cai <cai@lca.pw>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	David Hildenbrand <david@redhat.com>,
	Mike Kravetz <mike.kravetz@oracle.com>
Subject: Re: memory offline infinite loop after soft offline
Date: Fri, 18 Oct 2019 08:06:35 +0200	[thread overview]
Message-ID: <20191018060635.GA5017@dhcp22.suse.cz> (raw)
In-Reply-To: <20191018021906.GA24978@hori.linux.bs1.fc.nec.co.jp>

On Fri 18-10-19 02:19:06, Naoya Horiguchi wrote:
> On Thu, Oct 17, 2019 at 08:27:59PM +0200, Michal Hocko wrote:
> > On Thu 17-10-19 14:07:13, Qian Cai wrote:
> > > On Thu, 2019-10-17 at 12:01 +0200, Michal Hocko wrote:
> > > > On Thu 17-10-19 09:34:10, Naoya Horiguchi wrote:
> > > > > On Mon, Oct 14, 2019 at 10:39:14AM +0200, Michal Hocko wrote:
> > > > 
> > > > [...]
> > > > > > diff --git a/mm/page_isolation.c b/mm/page_isolation.c
> > > > > > index 89c19c0feadb..5fb3fee16fde 100644
> > > > > > --- a/mm/page_isolation.c
> > > > > > +++ b/mm/page_isolation.c
> > > > > > @@ -274,7 +274,7 @@ __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn,
> > > > > >  			 * simple way to verify that as VM_BUG_ON(), though.
> > > > > >  			 */
> > > > > >  			pfn += 1 << page_order(page);
> > > > > > -		else if (skip_hwpoisoned_pages && PageHWPoison(page))
> > > > > > +		else if (skip_hwpoisoned_pages && PageHWPoison(compound_head(page)))
> > > > > >  			/* A HWPoisoned page cannot be also PageBuddy */
> > > > > >  			pfn++;
> > > > > >  		else
> > > > > 
> > > > > This fix looks good to me. The original code only addresses hwpoisoned 4kB-page,
> > > > > we seem to have this issue since the following commit,
> > > > 
> > > > Thanks a lot for double checking Naoya!
> > > >  
> > > > >   commit b023f46813cde6e3b8a8c24f432ff9c1fd8e9a64
> > > > >   Author: Wen Congyang <wency@cn.fujitsu.com>
> > > > >   Date:   Tue Dec 11 16:00:45 2012 -0800
> > > > >   
> > > > >       memory-hotplug: skip HWPoisoned page when offlining pages
> > > > > 
> > > > > and extension of LTP coverage finally discovered this.
> > > > 
> > > > Qian, could you give the patch some testing?
> > > 
> > > Unfortunately, this does not solve the problem. It looks to me that in
> > > soft_offline_huge_page(), set_hwpoison_free_buddy_page() will only set
> > > PG_hwpoison for buddy pages, so the even the compound_head() has no PG_hwpoison
> > > set.
> > > 
> > > 		if (PageBuddy(page_head) && page_order(page_head) >= order) {
> > > 			if (!TestSetPageHWPoison(page))
> > > 				hwpoisoned = true;
> > 
> > This is more than unexpected. How are we supposed to find out that the
> > page is poisoned? Any idea Naoya?
> 
> # sorry for my poor review...
> 
> We set PG_hwpoison bit only on the head page for hugetlb, that's because
> we handle multiple pages as a single one for hugetlb. So it's enough
> to check isolation only on the head page.  Simply skipping pfn cursor to
> the page after the hugepage should avoid the infinite loop:

But the page dump Qian provided shows that the head page doesn't have
HWPoison bit either. If it had then going pfn at a time should just work
because all tail pages would be skipped. Or do I miss something?
 
>   @@ -274,9 +274,13 @@ __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn,
>    			 * simple way to verify that as VM_BUG_ON(), though.
>    			 */
>    			pfn += 1 << page_order(page);
>   -		else if (skip_hwpoisoned_pages && PageHWPoison(page))
>   -			/* A HWPoisoned page cannot be also PageBuddy */
>   -			pfn++;
>   +		else if (skip_hwpoisoned_pages && PageHWPoison(compound_head(page)))
>   +			/*
>   +			 * A HWPoisoned page cannot be also PageBuddy.
>   +			 * PG_hwpoison could be set only on the head page in
>   +			 * hugetlb case, so no need to check tail pages.
>   +			 */
>   +			pfn += 1 << compound_order(page);
>    		else
>    			break;
>    	}
> 
> Qian, could you please try this?
> 
> Thanks,
> Naoya Horiguchi

-- 
Michal Hocko
SUSE Labs


  reply	other threads:[~2019-10-18  6:06 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11 21:32 Qian Cai
2019-10-12 10:30 ` osalvador
2019-10-14  8:39 ` Michal Hocko
2019-10-17  9:34   ` Naoya Horiguchi
2019-10-17 10:01     ` Michal Hocko
2019-10-17 10:03       ` David Hildenbrand
2019-10-17 18:07       ` Qian Cai
2019-10-17 18:27         ` Michal Hocko
2019-10-18  2:19           ` Naoya Horiguchi
2019-10-18  6:06             ` Michal Hocko [this message]
2019-10-18  6:32               ` Naoya Horiguchi
2019-10-18  7:33                 ` Michal Hocko
2019-10-18  8:46                   ` Naoya Horiguchi
2019-10-18 11:56                 ` Qian Cai
2019-10-21  3:16                   ` Naoya Horiguchi
2020-05-15  2:46                     ` Qian Cai
2020-05-15  3:48                       ` HORIGUCHI NAOYA(堀口 直也)
2019-10-18  8:13             ` David Hildenbrand
2019-10-18  8:24               ` Michal Hocko
2019-10-18  8:38                 ` David Hildenbrand
2019-10-18  8:55                   ` Michal Hocko
2019-10-18 11:00                     ` David Hildenbrand
2019-10-18 11:05                       ` David Hildenbrand
2019-10-18 11:34                       ` Michal Hocko
2019-10-18 11:51                         ` David Hildenbrand

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=20191018060635.GA5017@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=cai@lca.pw \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=n-horiguchi@ah.jp.nec.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