[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190129185005.GC10129@iweiny-DESK2.sc.intel.com>
Date: Tue, 29 Jan 2019 10:50:05 -0800
From: Ira Weiny <ira.weiny@...el.com>
To: Jason Gunthorpe <jgg@...pe.ca>
Cc: Davidlohr Bueso <dave@...olabs.net>, akpm@...ux-foundation.org,
dledford@...hat.com, jack@...e.de, linux-rdma@...r.kernel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
dennis.dalessandro@...el.com, mike.marciniszyn@...el.com,
Davidlohr Bueso <dbueso@...e.de>
Subject: Re: [PATCH 3/6] drivers/IB,qib: do not use mmap_sem
On Mon, Jan 28, 2019 at 09:46:07PM -0700, Jason Gunthorpe wrote:
> On Mon, Jan 28, 2019 at 04:31:40PM -0700, Jason Gunthorpe wrote:
> > On Mon, Jan 21, 2019 at 09:42:17AM -0800, Davidlohr Bueso wrote:
> > > The driver uses mmap_sem for both pinned_vm accounting and
> > > get_user_pages(). By using gup_fast() and letting the mm handle
> > > the lock if needed, we can no longer rely on the semaphore and
> > > simplify the whole thing as the pinning is decoupled from the lock.
> > >
> > > This also fixes a bug that __qib_get_user_pages was not taking into
> > > account the current value of pinned_vm.
> > >
> > > Cc: dennis.dalessandro@...el.com
> > > Cc: mike.marciniszyn@...el.com
> > > Reviewed-by: Ira Weiny <ira.weiny@...el.com>
> > > Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
> > > drivers/infiniband/hw/qib/qib_user_pages.c | 67 ++++++++++--------------------
> > > 1 file changed, 22 insertions(+), 45 deletions(-)
> >
> > I need you to respin this patch/series against the latest rdma tree:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git
> >
> > branch for-next
> >
> > > diff --git a/drivers/infiniband/hw/qib/qib_user_pages.c b/drivers/infiniband/hw/qib/qib_user_pages.c
> > > -static int __qib_get_user_pages(unsigned long start_page, size_t num_pages,
> > > - struct page **p)
> > > -{
> > > - unsigned long lock_limit;
> > > - size_t got;
> > > - int ret;
> > > -
> > > - lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
> > > -
> > > - if (num_pages > lock_limit && !capable(CAP_IPC_LOCK)) {
> > > - ret = -ENOMEM;
> > > - goto bail;
> > > - }
> > > -
> > > - for (got = 0; got < num_pages; got += ret) {
> > > - ret = get_user_pages(start_page + got * PAGE_SIZE,
> > > - num_pages - got,
> > > - FOLL_WRITE | FOLL_FORCE,
> > > - p + got, NULL);
> >
> > As this has been rightly changed to get_user_pages_longterm, and I
> > think the right answer to solve the conflict is to discard some of
> > this patch?
>
> .. and I'm looking at some of the other conversions here.. *most
> likely* any caller that is manipulating rlimit for get_user_pages
> should really be calling get_user_pages_longterm, so they should not
> be converted to use _fast?
Is this a question? I'm not sure I understand the meaning here?
Ira
>
> Jason
Powered by blists - more mailing lists