John Hubbard <jhubbard@xxxxxxxxxx> writes:
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,ie. Doesn't this unpinning need to happen in
long i, ret;
folios = kmalloc_array(nr_pages, sizeof(*folios), GFP_KERNEL);
- if (!folios)
+ if (!folios) {
+ unpin_user_pages(pages, nr_pages);
check_and_migrate_movable_folios()?
It already does.
check_and_migrate_movable_folios() calls
migrate_longterm_unpinnable_folios(), which unpins if errors occur.
Right you are.
Reviewed-by: Alistair Popple <apopple@xxxxxxxxxx>
As an aside for future clean-ups we could probably get something nicer
if we reversed the process of pin/migrate to migrate/pin. In other words
if FOLL_LONGERM try and migrate the entire range first out of
ZONE_MOVABLE first. Migration invovles walking page tables and getting a
reference on the pages anyway, so if it turns out there is nothing to
migrate you haven't lost anything performance wise.