[PATCH 1/1] arch/mm/fault: fix major fault accounting when retrying under per-VMA lock

Suren Baghdasaryan surenb at google.com
Tue Jan 23 17:45:25 AEDT 2024


On Sun, Jan 21, 2024 at 11:38 PM Suren Baghdasaryan <surenb at google.com> wrote:
>
> On Sat, Jan 20, 2024 at 1:15 PM Russell King (Oracle)
> <linux at armlinux.org.uk> wrote:
> >
> > On Sat, Jan 20, 2024 at 09:09:47PM +0000, patchwork-bot+linux-riscv at kernel.org wrote:
> > > Hello:
> > >
> > > This patch was applied to riscv/linux.git (fixes)
> > > by Andrew Morton <akpm at linux-foundation.org>:
> > >
> > > On Tue, 26 Dec 2023 13:46:10 -0800 you wrote:
> > > > A test [1] in Android test suite started failing after [2] was merged.
> > > > It turns out that after handling a major fault under per-VMA lock, the
> > > > process major fault counter does not register that fault as major.
> > > > Before [2] read faults would be done under mmap_lock, in which case
> > > > FAULT_FLAG_TRIED flag is set before retrying. That in turn causes
> > > > mm_account_fault() to account the fault as major once retry completes.
> > > > With per-VMA locks we often retry because a fault can't be handled
> > > > without locking the whole mm using mmap_lock. Therefore such retries
> > > > do not set FAULT_FLAG_TRIED flag. This logic does not work after [2]
> > > > because we can now handle read major faults under per-VMA lock and
> > > > upon retry the fact there was a major fault gets lost. Fix this by
> > > > setting FAULT_FLAG_TRIED after retrying under per-VMA lock if
> > > > VM_FAULT_MAJOR was returned. Ideally we would use an additional
> > > > VM_FAULT bit to indicate the reason for the retry (could not handle
> > > > under per-VMA lock vs other reason) but this simpler solution seems
> > > > to work, so keeping it simple.
> > > >
> > > > [...]
> > >
> > > Here is the summary with links:
> > >   - [1/1] arch/mm/fault: fix major fault accounting when retrying under per-VMA lock
> > >     https://git.kernel.org/riscv/c/46e714c729c8
> > >
> > > You are awesome, thank you!
> >
> > Now that 32-bit ARM has support for the per-VMA lock, does that also
> > need to be patched?
>
> Yes, I think so. I missed the ARM32 change that added support for
> per-VMA locks. Will post a similar patch for it tomorrow.

Fix for ARM posted at
https://lore.kernel.org/all/20240123064305.2829244-1-surenb@google.com/

> Thanks,
> Suren.
>
> >
> > --
> > RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> > FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


More information about the Linuxppc-dev mailing list