diff options
author | Davidlohr Bueso <dave@stgolabs.net> | 2019-02-06 09:59:15 -0800 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-02-07 12:54:02 -0700 |
commit | 70f8a3ca68d3e1f3344d959981ca55d5f6ec77f7 (patch) | |
tree | 5c43234a8f1697bf3d1a4a8926a014b922b046ff /include/linux/mm_types.h | |
parent | a2bfd708b17adb6e597e70d4eca824667f2d4e3c (diff) | |
download | linux-70f8a3ca68d3e1f3344d959981ca55d5f6ec77f7.tar.gz linux-70f8a3ca68d3e1f3344d959981ca55d5f6ec77f7.tar.bz2 linux-70f8a3ca68d3e1f3344d959981ca55d5f6ec77f7.zip |
mm: make mm->pinned_vm an atomic64 counter
Taking a sleeping lock to _only_ increment a variable is quite the
overkill, and pretty much all users do this. Furthermore, some drivers
(ie: infiniband and scif) that need pinned semantics can go to quite
some trouble to actually delay via workqueue (un)accounting for pinned
pages when not possible to acquire it.
By making the counter atomic we no longer need to hold the mmap_sem and
can simply some code around it for pinned_vm users. The counter is 64-bit
such that we need not worry about overflows such as rdma user input
controlled from userspace.
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Christoph Lameter <cl@linux.com>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'include/linux/mm_types.h')
-rw-r--r-- | include/linux/mm_types.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 2c471a2c43fa..acea2ea2d6c4 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -405,7 +405,7 @@ struct mm_struct { unsigned long total_vm; /* Total pages mapped */ unsigned long locked_vm; /* Pages that have PG_mlocked set */ - unsigned long pinned_vm; /* Refcount permanently increased */ + atomic64_t pinned_vm; /* Refcount permanently increased */ unsigned long data_vm; /* VM_WRITE & ~VM_SHARED & ~VM_STACK */ unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE & ~VM_STACK */ unsigned long stack_vm; /* VM_STACK */ |