Re: [PATCH v5 3/3] userfaultfd: use per-vma locks in userfaultfd operations

From: Liam R. Howlett
Date: Tue Feb 13 2024 - 14:28:23 EST


* Lokesh Gidra <lokeshgidra@xxxxxxxxxx> [240213 14:18]:
..

> > > We could use something like uffd_prepare(), uffd_complete() but I
> > > thought of those names rather late in the cycle, but I've already caused
> > > many iterations of this patch set and that clean up didn't seem as vital
> > > as simplicity and clarity of the locking code.
>
> I anyway have to send another version to fix the error handling that
> you reported earlier. I can take care of this in that version.
>
> mfill_atomic...() functions (annoyingly) have to sometimes unlock and
> relock. Using prepare/complete in that context seems incompatible.
>
> >
> > Maybe lock_vma_for_uffd()/unlock_vma_for_uffd()? Whatever name is
> > better I'm fine with it but all these #ifdef's sprinkled around don't
> > contribute to the readability.
>
> I'll wait for an agreement on this because I too don't like using so
> many ifdef's either.
>
> Since these functions are supposed to have prototype depending on
> mfill/move, how about the following names:
>
> uffd_lock_mfill_vma()/uffd_unlock_mfill_vma()
> uffd_lock_move_vmas()/uffd_unlock_move_vmas()
>
> Of course, I'm open to other suggestions as well.
>

I'm happy with those if you remove the vma/vmas from the name.