Re: [PATCH 02/31] mm/migrate: remove cruft from migration_entry_wait()s

From: Hugh Dickins
Date: Tue May 23 2023 - 21:57:29 EST


On Tue, 23 May 2023, Alistair Popple wrote:
>
> Hugh Dickins <hughd@xxxxxxxxxx> writes:
>
> > migration_entry_wait_on_locked() does not need to take a mapped pte
> > pointer, its callers can do the unmap first. Annotate it with
> > __releases(ptl) to reduce sparse warnings.
>
> Thanks Hugh, I debated doing something similar when I reworked this to
> not take a pageref. However I was unsure if the pte unmap/unlock
> ordering mattered as this reverses the order of operations (from unlock
> then unmap to unmap then unlock).
>
> I never found any reason why that would be a problem though so please
> add:
>
> Reviewed-by: Alistair Popple <apopple@xxxxxxxxxx>

Thanks Alistair. Right, the ordering doesn't matter: you might briefly
think that because I'm going to put the rcu_read_unlock() into the
pte_unmap(), that there's something wrong with doing that early; but
you'd quickly realize that holding on to the spinlock is good enough.

Hugh