Re: [PATCH 15/31] mm/userfaultfd: allow pte_offset_map_lock() to fail

From: Peter Xu
Date: Wed May 24 2023 - 18:45:13 EST

Hi, Hugh,

On Sun, May 21, 2023 at 10:07:35PM -0700, Hugh Dickins wrote:
> mfill_atomic_install_pte() and mfill_atomic_pte_zeropage() treat
> failed pte_offset_map_lock() as -EFAULT, with no attempt to retry.

Could you help explain why it should be -EFAULT, not -EAGAIN or -EEXIST?

IIUC right now if pte existed we have -EEXIST returned as part of the
userfault ABI, no matter whether it's pte or thp.

IMHO it may boil down to my limited knowledge on how pte_offset_map_lock()
is used after this part 2 series, and I assume the core changes will be in
your 3rd series (besides this one and the arch one).

Please shed some light if there's quick answers (IIUC this is for speeding
up collapsing shmem thps, but still no much clue here), or I can also wait
for reading the 3rd part if it'll come soon in any form.


Peter Xu