mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [withdrawn] mm-util-account_locked_vm-does-not-hold-mmap_lock.patch removed from -mm tree
@ 2020-08-04  1:23 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2020-08-04  1:23 UTC (permalink / raw)
  To: alex.williamson, bmt, cohuck, daniel.m.jordan, dbueso, dledford,
	fly, hughd, jgg, jglisse, jhubbard, kirill.shutemov, ldufour,
	Liam.Howlett, mm-commits, peterz, rientjes, vbabka, walken,
	willy, yinghan


The patch titled
     Subject: mm, util: account_locked_vm() does not hold mmap_lock
has been removed from the -mm tree.  Its filename was
     mm-util-account_locked_vm-does-not-hold-mmap_lock.patch

This patch was dropped because it was withdrawn

------------------------------------------------------
From: Pengfei Li <fly@kernel.page>
Subject: mm, util: account_locked_vm() does not hold mmap_lock

Since mm->locked_vm is already an atomic counter, account_locked_vm()
does not need to hold mmap_lock.

Link: http://lkml.kernel.org/r/20200726080224.205470-2-fly@kernel.page
Signed-off-by: Pengfei Li <fly@kernel.page>
Cc: Bernard Metzler <bmt@zurich.ibm.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Laurent Dufour <ldufour@linux.ibm.com>
Cc: Davidlohr Bueso <dbueso@suse.de>
Cc: David Rientjes <rientjes@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Liam Howlett <Liam.Howlett@oracle.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ying Han <yinghan@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/vfio/vfio_iommu_type1.c |    8 ++------
 mm/util.c                       |   15 +++------------
 2 files changed, 5 insertions(+), 18 deletions(-)

--- a/drivers/vfio/vfio_iommu_type1.c~mm-util-account_locked_vm-does-not-hold-mmap_lock
+++ a/drivers/vfio/vfio_iommu_type1.c
@@ -376,12 +376,8 @@ static int vfio_lock_acct(struct vfio_dm
 	if (!mm)
 		return -ESRCH; /* process exited */
 
-	ret = mmap_write_lock_killable(mm);
-	if (!ret) {
-		ret = __account_locked_vm(mm, abs(npage), npage > 0, dma->task,
-					  dma->lock_cap);
-		mmap_write_unlock(mm);
-	}
+	ret = __account_locked_vm(mm, abs(npage), npage > 0,
+					dma->task, dma->lock_cap);
 
 	if (async)
 		mmput(mm);
--- a/mm/util.c~mm-util-account_locked_vm-does-not-hold-mmap_lock
+++ a/mm/util.c
@@ -424,8 +424,7 @@ void arch_pick_mmap_layout(struct mm_str
  * @task:        task used to check RLIMIT_MEMLOCK
  * @bypass_rlim: %true if checking RLIMIT_MEMLOCK should be skipped
  *
- * Assumes @task and @mm are valid (i.e. at least one reference on each), and
- * that mmap_lock is held as writer.
+ * Assumes @task and @mm are valid (i.e. at least one reference on each).
  *
  * Return:
  * * 0       on success
@@ -437,8 +436,6 @@ int __account_locked_vm(struct mm_struct
 	unsigned long locked_vm, limit;
 	int ret = 0;
 
-	mmap_assert_write_locked(mm);
-
 	locked_vm = atomic64_read(&mm->locked_vm);
 	if (inc) {
 		if (!bypass_rlim) {
@@ -476,17 +473,11 @@ EXPORT_SYMBOL_GPL(__account_locked_vm);
  */
 int account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc)
 {
-	int ret;
-
 	if (pages == 0 || !mm)
 		return 0;
 
-	mmap_write_lock(mm);
-	ret = __account_locked_vm(mm, pages, inc, current,
-				  capable(CAP_IPC_LOCK));
-	mmap_write_unlock(mm);
-
-	return ret;
+	return __account_locked_vm(mm, pages, inc,
+					current, capable(CAP_IPC_LOCK));
 }
 EXPORT_SYMBOL_GPL(account_locked_vm);
 
_

Patches currently in -mm which might be from fly@kernel.page are



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-04  1:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-04  1:23 [withdrawn] mm-util-account_locked_vm-does-not-hold-mmap_lock.patch removed from -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).