[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210318133412.12078eb7@alex-virtual-machine>
Date: Thu, 18 Mar 2021 13:34:12 +0800
From: Aili Yao <yaoaili@...gsoft.com>
To: Matthew Wilcox <willy@...radead.org>
CC: David Hildenbrand <david@...hat.com>, <akpm@...ux-foundation.org>,
<naoya.horiguchi@....com>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, <yangfeng1@...gsoft.com>,
<sunhao2@...gsoft.com>, Oscar Salvador <osalvador@...e.de>,
Mike Kravetz <mike.kravetz@...cle.com>, <yaoaili@...gsoft.com>
Subject: Re: [PATCH] mm/gup: check page posion status for coredump.
On Thu, 18 Mar 2021 04:46:00 +0000
Matthew Wilcox <willy@...radead.org> wrote:
> On Wed, Mar 17, 2021 at 10:12:02AM +0100, David Hildenbrand wrote:
> > > + if (IS_ENABLED(CONFIG_MEMORY_FAILURE) && ret == 1) {
> > > + if (unlikely(PageHuge(page) && PageHWPoison(compound_head(page))))
> > > + ret = 0;
> > > + else if (unlikely(PageHWPoison(page)))
> > > + ret = 0;
> > > + }
> >
> > I wonder if a simple
> >
> > if (PageHWPoison(compound_head(page)))
> > ret = 0;
> >
> > won't suffice. But I guess the "issue" is compound pages that are not huge
> > pages or transparent huge pages.
>
> THPs don't set the HWPoison bit on the head page.
>
> https://lore.kernel.org/linux-mm/20210316140947.GA3420@casper.infradead.org/
>
> (and PAGEFLAG(HWPoison, hwpoison, PF_ANY))
>
> By the way,
>
> #ifdef CONFIG_MEMORY_FAILURE
> PAGEFLAG(HWPoison, hwpoison, PF_ANY)
> TESTSCFLAG(HWPoison, hwpoison, PF_ANY)
> #define __PG_HWPOISON (1UL << PG_hwpoison)
> extern bool take_page_off_buddy(struct page *page);
> #else
> PAGEFLAG_FALSE(HWPoison)
> #define __PG_HWPOISON 0
> #endif
>
> so there's no need for this
> if (IS_ENABLED(CONFIG_MEMORY_FAILURE)
> check, as it simply turns into
>
> if (PageHuge(page) && 0)
> else if (0)
>
> and the compiler can optimise it all away.
Yes, You are right, I will modify this later.
Thanks for correction
--
Thanks!
Aili Yao
Powered by blists - more mailing lists