Re: [PATCH v2 2/2] mm: Extract non-swap page handling to do_non_swap_page()

From: David Hildenbrand (Arm)

Date: Fri Jul 24 2026 - 15:34:02 EST


On 7/23/26 05:07, Hongfu Li wrote:
> From: Hongfu Li <lihongfu@xxxxxxxxxx>
>
> Factor non-swap entry logic out of bloated do_swap_page() to simplify
> the main swap fault flow and improve readability.
>
> The new do_non_swap_page() handles migration, device private/exclusive,
> hwpoison, marker and bad PTE entries.
>
> Signed-off-by: Hongfu Li <lihongfu@xxxxxxxxxx>
> ---
> mm/memory.c | 120 ++++++++++++++++++++++++++++++----------------------
> 1 file changed, 69 insertions(+), 51 deletions(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index ae521baa8c84..50d8e92aef91 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -4815,6 +4815,74 @@ static void check_swap_exclusive(struct folio *folio, swp_entry_t entry,
> } while (--nr_pages);
> }
>
> +static vm_fault_t do_non_swap_page(struct vm_fault *vmf)

We're handling softleaf entries that are not swap entries.

do_nonswap_softleaf() or sth like that would be better than talking about "page"
if there is not even a page.

But actually it should be the other way around:

do_softleaf_entry() [currently do_swap_page]
... non-swap entries
do_swap_entry()

Or sth like that. Then, maybe in the future, we can just move do_swap_entry()
out of memory.c

So we're factoring the wrong thing out in this patch.

--
Cheers,

David