OSDN Git Service

mm: make mm->pinned_vm an atomic64 counter
authorDavidlohr Bueso <dave@stgolabs.net>
Wed, 6 Feb 2019 17:59:15 +0000 (09:59 -0800)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 7 Feb 2019 19:54:02 +0000 (12:54 -0700)
commit70f8a3ca68d3e1f3344d959981ca55d5f6ec77f7
tree5c43234a8f1697bf3d1a4a8926a014b922b046ff
parenta2bfd708b17adb6e597e70d4eca824667f2d4e3c
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>
drivers/infiniband/core/umem.c
drivers/infiniband/hw/hfi1/user_pages.c
drivers/infiniband/hw/qib/qib_user_pages.c
drivers/infiniband/hw/usnic/usnic_uiom.c
drivers/misc/mic/scif/scif_rma.c
fs/proc/task_mmu.c
include/linux/mm_types.h
kernel/events/core.c
kernel/fork.c
mm/debug.c