linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "HORIGUCHI NAOYA(堀口 直也)" <naoya.horiguchi@nec.com>
To: Yu Xu <xuyu@linux.alibaba.com>
Cc: Naoya Horiguchi <naoya.horiguchi@linux.dev>,
	Miaohe Lin <linmiaohe@huawei.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH] mm/memory-failure.c: bail out early if huge zero page
Date: Tue, 12 Apr 2022 11:11:03 +0000	[thread overview]
Message-ID: <20220412111102.GA3241018@hori.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <649dae7f-8513-0484-6565-cc0167015ac2@linux.alibaba.com>

On Tue, Apr 12, 2022 at 06:00:09PM +0800, Yu Xu wrote:
> On 4/12/22 5:45 PM, Yu Xu wrote:
...
> > > > > @@ -1087,12 +1087,21 @@ static int madvise_inject_error(int behavior,
> > > > >               return ret;
> > > > >           pfn = page_to_pfn(page);
> > > > > +        head = compound_head(page);
> > > > > +        if (unlikely(is_huge_zero_page(head))) {
> > > > > +            pr_warn("Unhandlable attempt to %s pfn %#lx at
> > > > > process virtual address %#lx\n",
> > > > > +                behavior == MADV_SOFT_OFFLINE ? "soft offline" :
> > > > > +                                "inject memory failure for",
> > > > > +                pfn, start);
> > > > > +            return -EINVAL;
> > > > > +        }
> > > 
> > > This check is about the detail of error handling, so I feel it
> > > desirable to
> > > do this in memory_failure().  And memory errors on huge zero page is the
> > > real scenario, so it seems to me better to make this case injectable
> > > rather
> > > than EINVAL.
> > > 
> > > How about checking is_huge_zero_page() before try_to_split_thp_page()?
> > > The result should be consistent with the results when called by other
> > > memory_failure()'s callers  like MCE handler and
> > > hard_offline_page_store().
> > 
> > Agree. thanks!
> > 
> > > 
> > > diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> > > index 9b76222ee237..771fb4fc626c 100644
> > > --- a/mm/memory-failure.c
> > > +++ b/mm/memory-failure.c
> > > @@ -1852,6 +1852,12 @@ int memory_failure(unsigned long pfn, int flags)
> > >       }
> > >       if (PageTransHuge(hpage)) {
> > > +        if (is_huge_zero_page(hpage)) {
> > > +            action_result(pfn, MF_MSG_KERNEL_HIGH_ORDER, MF_IGNORED);
> > 
> > Should we use MF_MSG_UNSPLIT_THP instead of MF_MSG_KERNEL_HIGH_ORDER?
> > 
> > And should we SetPageHasHWPoisoned(hpage) for huge zero page, since
> > TestSetPageHWPoison(p) is done in the early part of memory_failure().

Yeah, these could be possible.  I suggested them to get the same result
regardless of calling interfaces of memory_failure().  How huge_zero pages
should be handled is separate from the reported issue on VM_BUG_ON_PAGE(),
so it would require a separate patch (which updates MF_COUNT_INCREASED=true
case too).

Thanks,
Naoya Horiguchi

> 
> If so, we just need to add a one-line condition in
> try_to_split_thp_page().


  reply	other threads:[~2022-04-12 11:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-10 15:22 [PATCH] mm/memory-failure.c: bail out early if huge zero page Xu Yu
2022-04-11  2:18 ` Miaohe Lin
2022-04-12  9:09   ` Naoya Horiguchi
2022-04-12  9:45     ` Yu Xu
2022-04-12 10:00       ` Yu Xu
2022-04-12 11:11         ` HORIGUCHI NAOYA(堀口 直也) [this message]
2022-04-12 11:08     ` Miaohe Lin
2022-04-13  8:36       ` HORIGUCHI NAOYA(堀口 直也)
2022-04-13  9:03         ` Miaohe Lin
2022-04-12  8:31 ` Oscar Salvador
2022-04-12  9:25   ` Miaohe Lin
2022-04-12  9:30     ` Oscar Salvador
2022-04-12  9:47       ` Yu Xu
2022-04-12 10:58       ` Miaohe Lin
2022-04-12  8:59 ` Yu Xu

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=20220412111102.GA3241018@hori.linux.bs1.fc.nec.co.jp \
    --to=naoya.horiguchi@nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-mm@kvack.org \
    --cc=naoya.horiguchi@linux.dev \
    --cc=xuyu@linux.alibaba.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).