From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: From: Jason Gunthorpe Subject: Re: [PATCH] mm: add account_locked_vm utility function Date: Fri, 3 May 2019 23:28:22 +0000 Message-ID: <20190503232818.GA5182@mellanox.com> References: <20190503201629.20512-1-daniel.m.jordan@oracle.com> In-Reply-To: <20190503201629.20512-1-daniel.m.jordan@oracle.com> Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: <6BC684B50DAD6D4A8D031B0B8F7E32C4@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 To: Daniel Jordan Cc: "akpm@linux-foundation.org" , Alan Tull , Alexey Kardashevskiy , Alex Williamson , Benjamin Herrenschmidt , Christoph Lameter , Christophe Leroy , Davidlohr Bueso , Mark Rutland , Michael Ellerman , Moritz Fischer , Paul Mackerras , Steve Sistare , Wu Hao , "linux-mm@kvack.org" , "kvm@vger.kernel.org" , "kvm-ppc@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-fpga@vger.kernel.org" , "linux-kernel@vger.kernel.org" List-ID: 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. >=20 > Signed-off-by: Daniel Jordan > Cc: Alan Tull > Cc: Alexey Kardashevskiy > Cc: Alex Williamson > Cc: Andrew Morton > Cc: Benjamin Herrenschmidt > Cc: Christoph Lameter > Cc: Christophe Leroy > Cc: Davidlohr Bueso > Cc: Jason Gunthorpe > Cc: Mark Rutland > Cc: Michael Ellerman > Cc: Moritz Fischer > Cc: Paul Mackerras > Cc: Steve Sistare > Cc: Wu Hao > 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 >=20 > Based on v5.1-rc7. Tested with the vfio type1 driver. Any feedback > welcome. >=20 > Andrew, this one patch replaces these six from [1]: >=20 > 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 >=20 > That series converts locked_vm to an atomic, but on closer inspection cau= ses 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