[PATCH 12/46] mm/huge_memory: fix livelock on device private folio
Zi Yan
ziy at nvidia.com
Tue Oct 27 19:08:10 PDT 2026
On Mon Oct 26, 2026 at 7:17 PM EDT, David Hildenbrand (Arm) wrote:
> From: Josef Bacik <josef at toxicpanda.com>
>
> If do_huge_pmd_device_private() cannot lock the folio, it simply returns
> to try again on the next fault.
>
> Just like we did in commit b570f37a2ce4 ("mm: Fix a hmm_range_fault()
> livelock / starvation problem"), let's wait for the softleaf entry,
> which will drop the PTL and wait until the folio was unlocked. This is
> precisely what we do in do_swap_page() with device-private folios. This
> avoids possibly livelocking.
>
> Update softleaf_entry_wait_on_locked() documentation to clarify that
> device-private entries wait until the folio is unlocked.
>
> There seems to be no compelling reason to backport this to stable
> kernels unless we actually see problems there.
>
> Fix generated by an LLM and sent by Josef Bacik in private.
>
> Fixes: 4964099163d0 ("mm/memory/fault: add THP fault handling for zone device private pages")
> Signed-off-by: Josef Bacik <josef at toxicpanda.com>
> [ david: simplify patch description, fixup softleaf_entry_wait_on_locked description]
> Signed-off-by: David Hildenbrand (Arm) <david at kernel.org>
> ---
> mm/filemap.c | 4 ++--
> mm/huge_memory.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
It matches what do_swap_page() does. Makes sense.
Reviewed-by: Zi Yan <ziy at nvidia.com>
--
Best Regards,
Yan, Zi
More information about the kexec
mailing list