Re: [PATCH v7 4/6] mm/memory-failure: short-circuit PG_reserved before get_hwpoison_page()

From: Breno Leitao

Date: Thu May 14 2026 - 07:07:53 EST


On Wed, May 13, 2026 at 09:49:28PM +0200, David Hildenbrand (Arm) wrote:
> On 5/13/26 17:39, Breno Leitao wrote:
> > The previous patch already classifies PG_reserved pages as
> > MF_MSG_KERNEL through the long path: get_hwpoison_page() calls
> > __get_hwpoison_page() which fails HWPoisonHandlable(), get_any_page()
> > exhausts its shake_page() retry budget, and the resulting
> > -ENOTRECOVERABLE is mapped to MF_MSG_KERNEL by the switch. The
> > outcome is correct but the work in between is wasted: shake_page()
> > cannot turn a reserved page into a handlable one.
>
> If really required, can we just move the check right there, into get_any_page() etc?

Sure, we might move it to get_any_page(). I took this current approach
based on the following facts:

1) Lance suggested it, and it sounded a good idea.
https://lore.kernel.org/all/20260512124837.38883-1-lance.yang@xxxxxxxxx/

2) There is a _similar_ check close to this one in memory_failure(),
just before this one:

if (TestSetPageHWPoison(p)) {
....
action_result()
goto unlock_mutex;
}

and now

if (PageReserved(p)) {
...
action_result()
goto unlock_mutes;
}

3) I wanted to give get it as real layering point, not handwaving.

That said, I will short-circuit reserved pages inside get_any_page(), in
an updated version.

Again, thanks for the review and direction!
--breno