Re: [PATCH v4 0/4] Use killable vma write locking in most places

Suren Baghdasaryan
2026-03-24T16:00:05Z

On Sun, Mar 22, 2026 at 9:29 PM Suren Baghdasaryan <surenb@google.com> wrote:
>
> On Sun, Mar 22, 2026 at 9:17 AM Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > On Sat, 21 Mar 2026 22:43:04 -0700 Suren Baghdasaryan <surenb@google.com> wrote:
> >
> > > Now that we have vma_start_write_killable() we can replace most of the
> > > vma_start_write() calls with it, improving reaction time to the kill
> > > signal.
> >
> > Thanks. Sashiko review raised a few possible issues:
> > https://sashiko.dev/#/patchset/20260322054309.898214-1-surenb@google.com
>
> Thanks! This Sashiko dude is good :)

Interestingly Sashiko had one false flag: "Does this code leave
mm->locked_vm permanently corrupted if vma_start_write_killable()
fails?"

In mlock_fixup() the path that we call vma_start_write_killable()
happens only if both new_vma_flags and old_vma_flags have their
VMA_LOCKED_BIT set. In such case nr_pages is 0, so "mm->locked_vm +=
nr_pages;" does not change the value of mm->locked_vm and we are fine.
Perhaps this can be used to improve the model?

CC'ing Roman.