Re: [PATCH v3] mm/gup: stop leaking pinned pages in low memory conditions

From: John Hubbard
Date: Sun Oct 20 2024 - 23:27:03 EST


On 10/20/24 4:26 PM, Alistair Popple wrote:
John Hubbard <jhubbard@xxxxxxxxxx> writes:
[...]
@@ -2437,8 +2440,10 @@ static long check_and_migrate_movable_pages(unsigned long nr_pages,
long i, ret;
folios = kmalloc_array(nr_pages, sizeof(*folios), GFP_KERNEL);
- if (!folios)
+ if (!folios) {
+ unpin_user_pages(pages, nr_pages);

ie. Doesn't this unpinning need to happen in
check_and_migrate_movable_folios()?

It already does.

check_and_migrate_movable_folios() calls
migrate_longterm_unpinnable_folios(), which unpins if errors occur.


thanks,
--
John Hubbard