All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Shi <shy828301@gmail.com>
To: Naoya Horiguchi <naoya.horiguchi@linux.dev>
Cc: Linux MM <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Tony Luck <tony.luck@intel.com>,
	Oscar Salvador <osalvador@suse.de>,
	Muchun Song <songmuchun@bytedance.com>,
	Mike Kravetz <mike.kravetz@oracle.com>,
	Michal Hocko <mhocko@suse.com>,
	David Hildenbrand <david@redhat.com>,
	Naoya Horiguchi <naoya.horiguchi@nec.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] mm/hwpoison: Retry with shake_page() for unhandlable pages
Date: Wed, 18 Aug 2021 21:32:41 -0700	[thread overview]
Message-ID: <CAHbLzkpAEZRTmnOnjVHYHGJ7ApjdC8eDh53DAnTHsG185QGOfQ@mail.gmail.com> (raw)
In-Reply-To: <20210819001958.2365157-1-naoya.horiguchi@linux.dev>

On Wed, Aug 18, 2021 at 5:20 PM Naoya Horiguchi
<naoya.horiguchi@linux.dev> wrote:
>
> From: Naoya Horiguchi <naoya.horiguchi@nec.com>
>
> HWPoisonHandlable() sometimes returns false for typical user pages
> due to races with average memory events like transfers over LRU lists.
> This causes failures in hwpoison handling.
>
> There's retry code for such a case but does not work because the retry
> loop reaches the retry limit too quickly before the page settles down to
> handlable state. Let get_any_page() call shake_page() to fix it.
>
> Fixes: 25182f05ffed ("mm,hwpoison: fix race with hugetlb page allocation")
> Reported-by: Tony Luck <tony.luck@intel.com>
> Signed-off-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
> Cc: stable@vger.kernel.org # 5.13
> ---
> ChangeLog v2:
> - get_any_page() return -EIO when retry limit reached (by Yang Shi)

Thanks for taking this. The fix looks good to me. Reviewed-by: Yang
Shi <shy828301@gmail.com>

> ---
>  mm/memory-failure.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git v5.14-rc6/mm/memory-failure.c v5.14-rc6_patched/mm/memory-failure.c
> index eefd823deb67..470400cc7513 100644
> --- v5.14-rc6/mm/memory-failure.c
> +++ v5.14-rc6_patched/mm/memory-failure.c
> @@ -1146,7 +1146,7 @@ static int __get_hwpoison_page(struct page *page)
>          * unexpected races caused by taking a page refcount.
>          */
>         if (!HWPoisonHandlable(head))
> -               return 0;
> +               return -EBUSY;
>
>         if (PageTransHuge(head)) {
>                 /*
> @@ -1199,9 +1199,15 @@ static int get_any_page(struct page *p, unsigned long flags)
>                         }
>                         goto out;
>                 } else if (ret == -EBUSY) {
> -                       /* We raced with freeing huge page to buddy, retry. */
> -                       if (pass++ < 3)
> +                       /*
> +                        * We raced with (possibly temporary) unhandlable
> +                        * page, retry.
> +                        */
> +                       if (pass++ < 3) {
> +                               shake_page(p, 1);
>                                 goto try_again;
> +                       }
> +                       ret = -EIO;
>                         goto out;
>                 }
>         }
> --
> 2.25.1
>
>

  reply	other threads:[~2021-08-19  4:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19  0:19 [PATCH v2] mm/hwpoison: Retry with shake_page() for unhandlable pages Naoya Horiguchi
2021-08-19  4:32 ` Yang Shi [this message]
2021-08-19  4:32   ` Yang Shi

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=CAHbLzkpAEZRTmnOnjVHYHGJ7ApjdC8eDh53DAnTHsG185QGOfQ@mail.gmail.com \
    --to=shy828301@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mike.kravetz@oracle.com \
    --cc=naoya.horiguchi@linux.dev \
    --cc=naoya.horiguchi@nec.com \
    --cc=osalvador@suse.de \
    --cc=songmuchun@bytedance.com \
    --cc=tony.luck@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.