Re: [PATCH v3] mm: gup: fix infinite loop within __get_longterm_locked

From: David Hildenbrand
Date: Wed Jan 22 2025 - 06:19:51 EST


On 22.01.25 02:26, zhaoyang.huang wrote:
From: Zhaoyang Huang <zhaoyang.huang@xxxxxxxxxx>

We can run into an infinite loop in __get_longterm_locked() when
collect_longterm_unpinnable_folios() finds only folios that are isolated
from the LRU or were never added to the LRU. This can happen when all
folios to be pinned are never added to the LRU, for example when
vm_ops->fault allocated pages using cma_alloc() and never added them to
the LRU.

Fix it by simply taking a look at the list in the single caller, to see
if anything was added.

Fixes: 67e139b02d99 ("mm/gup.c: refactor check_and_migrate_movable_pages()")

Reviewed-by: John Hubbard <jhubbard@xxxxxxxxxx>
Suggested-by: David Hildenbrand <david@xxxxxxxxxx>

^ you should CC all people here. "git send-email" will usually try doing that automatically. :)



Acked-by: David Hildenbrand <david@xxxxxxxxxx>

--
Cheers,

David / dhildenb