[PATCH] mm: add account_locked_vm utility function

Jason Gunthorpe jgg at mellanox.com
Sat May 4 09:28:22 AEST 2019


On Fri, May 03, 2019 at 01:16:30PM -0700, Daniel Jordan wrote:
> locked_vm accounting is done roughly the same way in five places, so
> unify them in a helper.  Standardize the debug prints, which vary
> slightly.  Error codes stay the same, so user-visible behavior does too.
> 
> Signed-off-by: Daniel Jordan <daniel.m.jordan at oracle.com>
> Cc: Alan Tull <atull at kernel.org>
> Cc: Alexey Kardashevskiy <aik at ozlabs.ru>
> Cc: Alex Williamson <alex.williamson at redhat.com>
> Cc: Andrew Morton <akpm at linux-foundation.org>
> Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>
> Cc: Christoph Lameter <cl at linux.com>
> Cc: Christophe Leroy <christophe.leroy at c-s.fr>
> Cc: Davidlohr Bueso <dave at stgolabs.net>
> Cc: Jason Gunthorpe <jgg at mellanox.com>
> Cc: Mark Rutland <mark.rutland at arm.com>
> Cc: Michael Ellerman <mpe at ellerman.id.au>
> Cc: Moritz Fischer <mdf at kernel.org>
> Cc: Paul Mackerras <paulus at ozlabs.org>
> Cc: Steve Sistare <steven.sistare at oracle.com>
> Cc: Wu Hao <hao.wu at intel.com>
> Cc: linux-mm at kvack.org
> Cc: kvm at vger.kernel.org
> Cc: kvm-ppc at vger.kernel.org
> Cc: linuxppc-dev at lists.ozlabs.org
> Cc: linux-fpga at vger.kernel.org
> Cc: linux-kernel at vger.kernel.org
> 
> Based on v5.1-rc7.  Tested with the vfio type1 driver.  Any feedback
> welcome.
> 
> Andrew, this one patch replaces these six from [1]:
> 
>     mm-change-locked_vms-type-from-unsigned-long-to-atomic64_t.patch
>     vfio-type1-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
>     vfio-spapr_tce-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
>     fpga-dlf-afu-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
>     kvm-book3s-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
>     powerpc-mmu-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
> 
> That series converts locked_vm to an atomic, but on closer inspection causes at
> least one accounting race in mremap, and fixing it just for this type
> conversion came with too much ugly in the core mm to justify, especially when
> the right long-term fix is making these drivers use pinned_vm instead.

Did we ever decide what to do here? Should all these drivers be
switched to pinned_vm anyhow?

Jason


More information about the Linuxppc-dev mailing list