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

From: Suren Baghdasaryan

Date: Tue Mar 24 2026 - 12:08:59 EST


On Sun, Mar 22, 2026 at 9:29 PM Suren Baghdasaryan <surenb@xxxxxxxxxx> wrote:
>
> On Sun, Mar 22, 2026 at 9:17 AM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > On Sat, 21 Mar 2026 22:43:04 -0700 Suren Baghdasaryan <surenb@xxxxxxxxxx> 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@xxxxxxxxxx
>
> 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.