Re: [PATCH] mm: add account_locked_vm utility function
From: Jason Gunthorpe <hidden>
Date: 2019-05-03 23:28:31
Also in:
kvm, linux-fpga, linux-mm, lkml
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@oracle.com>
Cc: Alan Tull <atull@kernel.org>
Cc: Alexey Kardashevskiy <redacted>
Cc: Alex Williamson <redacted>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Christoph Lameter <redacted>
Cc: Christophe Leroy <redacted>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Jason Gunthorpe <redacted>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Moritz Fischer <mdf@kernel.org>
Cc: Paul Mackerras <redacted>
Cc: Steve Sistare <redacted>
Cc: Wu Hao <redacted>
Cc: linux-mm@kvack.org
Cc: kvm@vger.kernel.org
Cc: kvm-ppc@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-fpga@vger.kernel.org
Cc: linux-kernel@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