On Sun, May 21, 2023 at 10:06:32PM -0700, Hugh Dickins wrote: > Instead of worrying whether the pmd is stable, userfaultfd_must_wait() > call pte_offset_map() as before, but go back to try again if that fails. > > Risk of endless loop? It already broke out if pmd_none(), !pmd_present() > or pmd_trans_huge(), and pte_offset_map() would have cleared pmd_bad(): > which leaves pmd_devmap(). Presumably pmd_devmap() is inappropriate in > a vma subject to userfaultfd (it would have been mistreated before), > but add a check just to avoid all possibility of endless loop there. Agreed, afaiu that's for either PFNMAP or MIXEDMAP vmas only. Maybe we can use a WARN_ON_ONCE() for that to be clear, but no strong opinions. > > Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx> Acked-by: Peter Xu <peterx@xxxxxxxxxx> -- Peter Xu