Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4988287imu; Tue, 29 Jan 2019 10:51:03 -0800 (PST) X-Google-Smtp-Source: ALg8bN4poJi1xwA4egH7jqKjamLX3brODU1VCL/AQ4jiSU4nbchc/g5SnEgsz6DHaXULkdn4hedr X-Received: by 2002:a17:902:2bc5:: with SMTP id l63mr27589774plb.107.1548787863469; Tue, 29 Jan 2019 10:51:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548787863; cv=none; d=google.com; s=arc-20160816; b=AtKSt3+FBMP2uxLPLtK5gByW+moRdalPgYt52sehY3No5qXiP8i/JeFb1NUc342AmH eTwGITNWdNsbpbjMkTSWzs6DEUK/wlB9Uwi0mcZPj7WPBrdQ8hGBL8vvNasz7Wkf5XDi DSYc6Rl11vqAksbEBMbkyzvYgsarhilaeliBSJ8SKVeMB1ltnPVDe694j05wGBtcIWCm uqwrSan0piG/Gf9Z5QDA06RD8DCivbaqRlinqpnlNlYpGlnnzWu1xo5iOKP9RsChsmlW subjSMcEbpRjuhI9hFsinnseFPCz6pmbZr5RPzhY2cOkcg2btMaUiPJDQE9qivoO338f 5Ibw== 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; bh=LO6uE/n1t+5ifcz3BMGrSt1mWI6jQqx2BZkjkAw/sGQ=; b=Gpq2cRbmQ6T61fHrJxKorhfQtR9TsSDL3uR5XtTyAZPOKCNqmlaPhouiLfdmx1JZlX NqD9AGg1I/LOr+3T4DPuZFZcaT3K3wDNaB09E4KGfsUeyf193DddybKb2WfDj/jk7LYU LzAx9LBpEypnUnGH8jvuvt+nA+v8SK2RcKD4oFKBs+DPq3r7fxMI27JZ9jvXCzWCq+h2 8sttfA1s8DTDbYCC9KtpSM8/JZb57wDED7I4KLGbled4h1Zy7rMJaRJIhPph5ByPcxEA vICqaOs5orfS4LJ5HtJCygy1kWrn/wozI8yJNDObm94ZFdlfk8UVXfU4+BSrB/cTr6gj b06g== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p64si36566547pfg.79.2019.01.29.10.50.47; Tue, 29 Jan 2019 10:51:03 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729158AbfA2Suf (ORCPT + 99 others); Tue, 29 Jan 2019 13:50:35 -0500 Received: from mga18.intel.com ([134.134.136.126]:7114 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727245AbfA2Suf (ORCPT ); Tue, 29 Jan 2019 13:50:35 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2019 10:50:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,537,1539673200"; d="scan'208";a="295436405" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by orsmga005.jf.intel.com with ESMTP; 29 Jan 2019 10:50:34 -0800 Date: Tue, 29 Jan 2019 10:50:05 -0800 From: Ira Weiny To: Jason Gunthorpe Cc: Davidlohr Bueso , akpm@linux-foundation.org, dledford@redhat.com, jack@suse.de, 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: <20190129185005.GC10129@iweiny-DESK2.sc.intel.com> References: <20190121174220.10583-1-dave@stgolabs.net> <20190121174220.10583-4-dave@stgolabs.net> <20190128233140.GA12530@ziepe.ca> <20190129044607.GL25106@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190129044607.GL25106@ziepe.ca> User-Agent: Mutt/1.11.1 (2018-12-01) 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 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@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? Is this a question? I'm not sure I understand the meaning here? Ira > > Jason