drivers/IB,qib: optimize mmap_sem usage
authorDavidlohr Bueso <dave@stgolabs.net>
Wed, 6 Feb 2019 17:59:17 +0000 (09:59 -0800)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 7 Feb 2019 19:54:02 +0000 (12:54 -0700)
commit3a2a1e90564e3ad215aa5c6ddc0e741cd6208a93
treee6abdb64e1af8e20a1a4204dca5f7f9388358c46
parent4f564ff3d4dd887955b25b83d06989610769bf32
drivers/IB,qib: optimize mmap_sem usage

The driver uses mmap_sem for both pinned_vm accounting and
get_user_pages(). Because rdma drivers might want to use gup_longterm() in
the future we still need some sort of mmap_sem serialization (as opposed
to removing it entirely by using gup_fast()). Now that pinned_vm is atomic
the writer lock can therefore be converted to reader.

This also fixes a bug that __qib_get_user_pages was not taking into
account the current value of pinned_vm.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/qib/qib_user_pages.c