From: Miaohe Lin <linmiaohe@huawei.com>
To: Breno Leitao <leitao@debian.org>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
<linux-doc@vger.kernel.org>, <kernel-team@meta.com>,
Naoya Horiguchi <nao.horiguchi@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH v4 2/3] mm/memory-failure: add panic option for unrecoverable pages
Date: Thu, 23 Apr 2026 10:38:19 +0800 [thread overview]
Message-ID: <c1517ad3-91d1-2ea1-efa7-0f29415d513d@huawei.com> (raw)
In-Reply-To: <aejlg62nxcF_5g2v@gmail.com>
On 2026/4/22 23:21, Breno Leitao wrote:
> Hello Miaohe,
>
> On Wed, Apr 22, 2026 at 11:36:11AM +0800, Miaohe Lin wrote:
>> On 2026/4/15 20:55, Breno Leitao wrote:
>>> Add a sysctl panic_on_unrecoverable_memory_failure that triggers a
>>> kernel panic when memory_failure() encounters pages that cannot be
>>> recovered. This provides a clean crash with useful debug information
>>> rather than allowing silent data corruption.
>>>
>>> The panic is triggered for three categories of unrecoverable failures,
>>> all requiring result == MF_IGNORED:
>>>
>>> - MF_MSG_KERNEL: reserved pages identified via PageReserved.
>>>
>>> - MF_MSG_KERNEL_HIGH_ORDER: pages with refcount 0 that are not in the
>>> buddy allocator (e.g., tail pages of high-order kernel allocations).
>>> A TOCTOU race between get_hwpoison_page() and is_free_buddy_page()
>>> is possible when CONFIG_DEBUG_VM is disabled, since check_new_pages()
>>> is gated by is_check_pages_enabled() and becomes a no-op. Panicking
>>> is still correct: the physical memory has a hardware error regardless
>>> of who allocated the page.
>>
>> What if the page is used by userspace? We can recover from later accessing.
>> Would panic here be overkill?
>
> A userspace page should not reach the MF_MSG_KERNEL_HIGH_ORDER branch. The
> branch is gated on get_hwpoison_page() == 0, i.e., folio_try_get() observed
> _refcount == 0, and that condition rules out a live userspace mapping, no?
Sorry, I didn't express myself clearly. What I mean is, a buddy page currently
being allocated could reach the MF_MSG_KERNEL_HIGH_ORDER branch. This page might
be allocated to a userspace. In this case, we can recover from later accessing.
But with your patch, panic will be triggered instead.
>
> are you suggesting I drop MF_MSG_KERNEL_HIGH_ORDER from here, or, document this
> will not hit userspace pages?
No, maybe we should rule out or document above rare case if I'm not miss something.
Thanks.
.
next prev parent reply other threads:[~2026-04-23 2:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 12:54 [PATCH v4 0/3] mm/memory-failure: add panic option for unrecoverable pages Breno Leitao
2026-04-15 12:55 ` [PATCH v4 1/3] mm/memory-failure: report MF_MSG_KERNEL for reserved pages Breno Leitao
2026-04-22 2:50 ` Miaohe Lin
2026-04-15 12:55 ` [PATCH v4 2/3] mm/memory-failure: add panic option for unrecoverable pages Breno Leitao
2026-04-22 3:36 ` Miaohe Lin
2026-04-22 15:21 ` Breno Leitao
2026-04-23 2:38 ` Miaohe Lin [this message]
2026-04-15 12:55 ` [PATCH v4 3/3] Documentation: document panic_on_unrecoverable_memory_failure sysctl Breno Leitao
2026-04-22 3:43 ` Miaohe Lin
2026-04-22 15:23 ` Breno Leitao
2026-04-23 2:05 ` Miaohe Lin
2026-04-15 20:56 ` [PATCH v4 0/3] mm/memory-failure: add panic option for unrecoverable pages Jiaqi Yan
2026-04-16 15:32 ` Breno Leitao
2026-04-16 16:26 ` Jiaqi Yan
2026-04-17 9:10 ` Breno Leitao
2026-04-18 0:18 ` Jiaqi Yan
2026-04-22 2:49 ` Miaohe Lin
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=c1517ad3-91d1-2ea1-efa7-0f29415d513d@huawei.com \
--to=linmiaohe@huawei.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=david@kernel.org \
--cc=kernel-team@meta.com \
--cc=leitao@debian.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=nao.horiguchi@gmail.com \
--cc=rppt@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
/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