Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4236444imu; Mon, 28 Jan 2019 20:46:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN4pbN8upejuOfTJQ8qlLMWH3WoERV9RhzAHN9d2SW8TDf014SYdYsYTpuDBPd9ymGRAJ4Af X-Received: by 2002:a17:902:bf0c:: with SMTP id bi12mr24798279plb.0.1548737210075; Mon, 28 Jan 2019 20:46:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548737210; cv=none; d=google.com; s=arc-20160816; b=QAQdUPsPi3jxwHelgmVU2a16aWLyydvmzl0ut7fQfgF8B6iT4vpyyRG692z4/oiFHT Oha6rdiQidNTvrwWycLY0FWzDzbo22zbiuj4N90u+krU5vvsUd2BY39kA3ZtdqG1Z6Pv RCqT8sTv7YagEf+OsdpM2dhtKdx6ynQbuP8yRdeOGnXA6b4j0h52xGU39/tsr/rp+2Fz UBo9jfDGqQcsvJCnWWAZqi3m+SaTsc+C3Z3tTyzM9kvDhIeJ3p5foX68+uGI+J8zVB3d gH+BA6t9y+CDRZDOiBE3vVC/+C2AHTtETMr5VdrfRuqwaxA7nagXZ16FrnfFkS8cGvdC laww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eVdQI+bKFnHxHsyrWVjxAl5UcBq6aUXQPMqjgJnSXMU=; b=vuVglhHc0Mx5gRBnv28Bab7F2GldRbDytebC8waIogqET7DcZQ/2y+x412vOIKzvdj 3GGVpEyaxaRrr2j/qXVLyYjRbb1xJU8KH7UqKmHNHROInQ0RFVQMxrSkzHrPeVaRJIH/ oMQMQFrWWyAHEJLepEUVg8TOCqaGb0L4xWZPtJlQYua4ghjA6ubxHumCEqt+T5CRNNyF QXD/ThowcjU+mrXrM70NmxM5sVUX47BnUJ6P+KwROiXE+Lsm2xGH/xZ4gBgRonrMgt0E oOMWB0Mc76bqPALdHlQcdPVN4UcXpatAghnErSoHndbQsOFkKQVIGqrzUuVxXwTDkfW/ Gh/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=AhB3TneB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p9si35730094pgc.448.2019.01.28.20.46.34; Mon, 28 Jan 2019 20:46:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=AhB3TneB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727237AbfA2EqK (ORCPT + 99 others); Mon, 28 Jan 2019 23:46:10 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:33531 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726950AbfA2EqK (ORCPT ); Mon, 28 Jan 2019 23:46:10 -0500 Received: by mail-pl1-f193.google.com with SMTP id z23so8814666plo.0 for ; Mon, 28 Jan 2019 20:46:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=eVdQI+bKFnHxHsyrWVjxAl5UcBq6aUXQPMqjgJnSXMU=; b=AhB3TneBFy5a0D3ECmn3nW0DFD00d64H7KXVKa2rW5c8hyVHul1zsyPBj53m+pAEn6 a3VzM3KcH8t2Btm5Qz/EHVh0SVk4D/dz+4lBGsMUPMlsQY7JrJpIoUhRX3JvrLBTtrUF hu+ABju5baJzTV6C6u2plaAYJbka1voJWQK4d1xS/t+oGAV5rgNy1Wtb9AmimQz9rDcn NK9GIET8z8CNIMWhVivUtsc+vbDm3xHvUKYhE4pCMl18Fbj0RGgcb2b6wstWaTY5SErZ eiwjt4GAeq78cF/eTYNjn5r5B/vr9moiRWvzJT1X3iffiFSmAiFT86VT01lQvrj8sZQe VY+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=eVdQI+bKFnHxHsyrWVjxAl5UcBq6aUXQPMqjgJnSXMU=; b=XUkn1HM4jlTBxasH3bJgR9QXxnkso+9fAg2pInQuMrsVOHV0s6aRrxJkceTczyThFZ EtALK5aTckJ4JRvFN5MB45fDcTZflVs+ackS1/V3JKgG9gjrPVRTQntgLXzVAe91xqK9 ETBPk1Ks4xt7PDUkXL5QB7lgAQDs6pOfcUU3sonz5g247lWz18mrwo7yJv2o8q0vOKIU rmCnfkOfSLuqVpquxCCcXRvUTdDJu++uFTcJ98dJKSQV0gogODvEqI7EhErv7/0DrOwQ 8iigj0yzD4ve1oV2OKTtztdyAh+jVT59ycpZ462+aWRQyH+vQCOacZJTK1I1Wqu8qOYU 81yg== X-Gm-Message-State: AJcUukdtcufo3DcfXvG99RGQLzZeQ2oBnjWgIQuQMRc84jlxxkHV8D81 ntsoB9qSR4ifI1yYDMmPV4P0sBhWmsg= X-Received: by 2002:a17:902:7c05:: with SMTP id x5mr24101332pll.273.1548737169100; Mon, 28 Jan 2019 20:46:09 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id h128sm66270847pgc.15.2019.01.28.20.46.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:46:08 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1goLHj-00040F-Du; Mon, 28 Jan 2019 21:46:07 -0700 Date: Mon, 28 Jan 2019 21:46:07 -0700 From: Jason Gunthorpe To: Davidlohr Bueso Cc: akpm@linux-foundation.org, dledford@redhat.com, jack@suse.de, ira.weiny@intel.com, linux-rdma@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, dennis.dalessandro@intel.com, mike.marciniszyn@intel.com, Davidlohr Bueso Subject: Re: [PATCH 3/6] drivers/IB,qib: do not use mmap_sem Message-ID: <20190129044607.GL25106@ziepe.ca> References: <20190121174220.10583-1-dave@stgolabs.net> <20190121174220.10583-4-dave@stgolabs.net> <20190128233140.GA12530@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190128233140.GA12530@ziepe.ca> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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@intel.com > > Cc: mike.marciniszyn@intel.com > > Reviewed-by: Ira Weiny > > Signed-off-by: Davidlohr Bueso > > 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? Jason