From: Vlastimil Babka <vbabka@suse.cz>
To: Oscar Salvador <osalvador@suse.de>, n-horiguchi@ah.jp.nec.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Naoya Horiguchi <naoya.horiguchi@nec.com>
Subject: Re: [PATCH v5 1/4] mm,hwpoison: drain pcplists before bailing out for non-buddy zero-refcount page
Date: Wed, 25 Nov 2020 17:26:47 +0100 [thread overview]
Message-ID: <1673f0cd-c943-c211-4707-410c5f018aab@suse.cz> (raw)
In-Reply-To: <20201013144447.6706-2-osalvador@suse.de>
On 10/13/20 4:44 PM, Oscar Salvador wrote:
> A page with 0-refcount and !PageBuddy could perfectly be a pcppage.
> Currently, we bail out with an error if we encounter such a page, meaning
> that we do not handle pcppages neither from hard-offline nor from
> soft-offline path.
>
> Fix this by draining pcplists whenever we find this kind of page and retry
> the check again. It might be that pcplists have been spilled into the
> buddy allocator and so we can handle it.
>
> Signed-off-by: Oscar Salvador <osalvador@suse.de>
> Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> mm/memory-failure.c | 24 ++++++++++++++++++++++--
> 1 file changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index c0bb186bba62..e2f12410c594 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -946,13 +946,13 @@ static int page_action(struct page_state *ps, struct page *p,
> }
>
> /**
> - * get_hwpoison_page() - Get refcount for memory error handling:
> + * __get_hwpoison_page() - Get refcount for memory error handling:
> * @page: raw error page (hit by memory error)
> *
> * Return: return 0 if failed to grab the refcount, otherwise true (some
> * non-zero value.)
> */
> -static int get_hwpoison_page(struct page *page)
> +static int __get_hwpoison_page(struct page *page)
> {
> struct page *head = compound_head(page);
>
> @@ -982,6 +982,26 @@ static int get_hwpoison_page(struct page *page)
> return 0;
> }
>
> +static int get_hwpoison_page(struct page *p)
> +{
> + int ret;
> + bool drained = false;
> +
> +retry:
> + ret = __get_hwpoison_page(p);
> + if (!ret && !is_free_buddy_page(p) && !page_count(p) && !drained) {
> + /*
> + * The page might be in a pcplist, so try to drain those
> + * and see if we are lucky.
> + */
> + drain_all_pages(page_zone(p));
> + drained = true;
> + goto retry;
> + }
> +
> + return ret;
> +}
> +
> /*
> * Do all that is necessary to remove user space mappings. Unmap
> * the pages and send SIGBUS to the processes if the data was dirty.
>
next prev parent reply other threads:[~2020-11-25 16:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-13 14:44 [PATCH v5 0/4] HWpoison: further fixes and cleanups Oscar Salvador
2020-10-13 14:44 ` [PATCH v5 1/4] mm,hwpoison: drain pcplists before bailing out for non-buddy zero-refcount page Oscar Salvador
2020-11-25 16:26 ` Vlastimil Babka [this message]
2020-10-13 14:44 ` [PATCH v5 2/4] mm,hwpoison: take free pages off the buddy freelists Oscar Salvador
2020-11-25 16:35 ` Vlastimil Babka
2020-10-13 14:44 ` [PATCH v5 3/4] mm,hwpoison: take free pages off the buddy freelists for hugetlb Oscar Salvador
2020-10-14 0:05 ` HORIGUCHI NAOYA(堀口 直也)
2020-11-25 16:36 ` Vlastimil Babka
2020-10-13 14:44 ` [PATCH v5 4/4] mm,hwpoison: drop unneeded pcplist draining Oscar Salvador
2020-10-14 0:06 ` HORIGUCHI NAOYA(堀口 直也)
2020-11-25 16:38 ` Vlastimil Babka
2020-11-10 6:21 ` [PATCH v5 0/4] HWpoison: further fixes and cleanups Oscar Salvador
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=1673f0cd-c943-c211-4707-410c5f018aab@suse.cz \
--to=vbabka@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=naoya.horiguchi@nec.com \
--cc=osalvador@suse.de \
/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