Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp196203ybx; Mon, 4 Nov 2019 18:33:53 -0800 (PST) X-Google-Smtp-Source: APXvYqzA3LJmQoIuS+GJAMiL5xJmbcarPrHMjyiGsdpD+MJxZbqKE2cIoWQv0kbOm0r/iBpfMobR X-Received: by 2002:a17:906:7f94:: with SMTP id f20mr27718657ejr.333.1572921233023; Mon, 04 Nov 2019 18:33:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572921233; cv=none; d=google.com; s=arc-20160816; b=tb6fFPoSa28KSOkKbBrokdOA3TlapDH67rE1/riyB/KgeqAPCoPQr6oYaybQzU/Jm9 gfJJCXISCzXCb7dSoeahbywfQ2olM5FDjLrFmITkMYZbbpc/tsihZ9yYEVOa2bONDS/b jlpd/JDGZpFCGcICG+tg6C0ETbnSr9t43NdM1QGJdeqlU6JatGMxzO45sxVtcKT4tkbS FVUyNWUP7BJKY3xPsRFpX3pb0260woy1bnXH4zEZrTd/zMbf5/hwLOL8Oj87vYBhmW3N RjVPsOGEe6Btj8OyO3rUmjeZpjJogDDbXV4tHkd+rJuguvGntVJ5Ur7jRtVa6bGDB+Ns UlOQ== 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=4urm9i82HUz7ctZoqeaJ+eDwbY+Le9I8/NmP0pY1rnA=; b=O/kHrNKba8+GL77/S0RW33p9m6lyiXGOkSyEfU62TCuk+ar+v9GDrl8kEDYttGbtei NPL8qeWDf2kB7JavSrif+MYO5Ca/Kr5mOJEM6mjQ3Tx+dFpA9JRXjm/UAdR7gjytVa4o EKQcazzMfUiYiA2NoKcyNXCiCYP0q7zU2dkx9kbicsg/lMFOWu8+F0NjjXEjqKu/Lcr7 0tl8ZM5BimtPdpxj2My4KOR9/BztppHEp69f39BVZcFqEiz4OVwwIa192ezYFi6fRZ4R lxmddniNbnlpHs8E+c4pg/vDrvOPzhO4wd+aKO65M0mfi8hyo1vMbBOlxYZdlqK4PkMe cELA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=RrEUUprS; 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 a11si10538937edj.143.2019.11.04.18.33.29; Mon, 04 Nov 2019 18:33:53 -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=RrEUUprS; 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 S1730216AbfKECcj (ORCPT + 99 others); Mon, 4 Nov 2019 21:32:39 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:39103 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729760AbfKECci (ORCPT ); Mon, 4 Nov 2019 21:32:38 -0500 Received: by mail-qt1-f195.google.com with SMTP id t8so27235309qtc.6 for ; Mon, 04 Nov 2019 18:32:37 -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=4urm9i82HUz7ctZoqeaJ+eDwbY+Le9I8/NmP0pY1rnA=; b=RrEUUprScGGCs1P3lOuGj4a5RoiWbVbfDZ4+HpgRvyTXCYVlJAXQB+MYamRZtedVHY f5+sxNxk2K5wkp7PjMMeD8HJWFAJHo3RtLYXlCrUl00LuH1GNIO+43+qB9VoRPGoMtd2 MhxxJSrVmcyNdw2dcAOft+ieDHmjkqcbx3xo51HlgztpG3sVxpkHZVlG9m+fgORfqdhb XySrfwIPRDIjnSUQNZ9F7DSfvHrKSEQZxN/D+pZKoiFoN1H+0mMnDQ/zYc1NegbKO5Qw fR/889wgnwS9AagFL4h4X1w9N0H+8w+Cg8HTo2zBy3ABWuxHxMoo0KJgJWvcNzShW5B1 QLlQ== 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=4urm9i82HUz7ctZoqeaJ+eDwbY+Le9I8/NmP0pY1rnA=; b=qfMkUSNuamIBNl5egcsazeXOb4to5KUr4uHZ+KEJcCgX7U2LiJAOWmPwNyd+BnYvtA 0K4KFYgsHhWA1oJZm3ICYusNcJ/99DR2JEcCaYtfR+K3KUecb36aEn/P0vMNMl4j2Aeh j8HHETymdI5fcnFRPoYxHhzuZDuTeMpcTL99RUhbGKQ7Is6wTtP5huzvmmND9EbjBC9j voSHSu/cy1m25zCXjJVaDW+WUbqM4AKpF2R+oGKQqtxnb1INRc4kMuZzZI2YvJfRc4In zSg7GNvDKLsHnGsyb0e0r+of/2LxFe/wb5E71tW7nEoBxjjloUB0CyBr7lhtrN8rnTlk +ijA== X-Gm-Message-State: APjAAAWLrRKE3/HBMD/0TAx7nRy0bhjjnnnwdBkFV68Q3c2nM4zCAOxX nNNJoDYKfZtAkLhW5VDQbrsNlA== X-Received: by 2002:a0c:9838:: with SMTP id c53mr25556531qvd.250.1572921156814; Mon, 04 Nov 2019 18:32:36 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-113-180.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.180]) by smtp.gmail.com with ESMTPSA id t65sm8907102qkh.23.2019.11.04.18.32.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Nov 2019 18:32:36 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1iRoe3-0002uH-K9; Mon, 04 Nov 2019 22:32:35 -0400 Date: Mon, 4 Nov 2019 22:32:35 -0400 From: Jason Gunthorpe To: John Hubbard Cc: Andrew Morton , Al Viro , Alex Williamson , Benjamin Herrenschmidt , =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , Christoph Hellwig , Dan Williams , Daniel Vetter , Dave Chinner , David Airlie , "David S . Miller" , Ira Weiny , Jan Kara , Jens Axboe , Jonathan Corbet , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Magnus Karlsson , Mauro Carvalho Chehab , Michael Ellerman , Michal Hocko , Mike Kravetz , Paul Mackerras , Shuah Khan , Vlastimil Babka , bpf@vger.kernel.org, dri-devel@lists.freedesktop.org, kvm@vger.kernel.org, linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-media@vger.kernel.org, linux-rdma@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, linux-mm@kvack.org, LKML Subject: Re: [PATCH v2 07/18] infiniband: set FOLL_PIN, FOLL_LONGTERM via pin_longterm_pages*() Message-ID: <20191105023235.GA11093@ziepe.ca> References: <20191103211813.213227-1-jhubbard@nvidia.com> <20191103211813.213227-8-jhubbard@nvidia.com> <20191104203346.GF30938@ziepe.ca> <578c1760-7221-4961-9f7d-c07c22e5c259@nvidia.com> <20191104205738.GH30938@ziepe.ca> <1560fa00-0c2b-0f3b-091c-d628f021ce09@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1560fa00-0c2b-0f3b-091c-d628f021ce09@nvidia.com> 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, Nov 04, 2019 at 02:03:43PM -0800, John Hubbard wrote: > On 11/4/19 12:57 PM, Jason Gunthorpe wrote: > > On Mon, Nov 04, 2019 at 12:48:13PM -0800, John Hubbard wrote: > >> On 11/4/19 12:33 PM, Jason Gunthorpe wrote: > >> ... > >>>> diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c > >>>> index 24244a2f68cc..c5a78d3e674b 100644 > >>>> +++ b/drivers/infiniband/core/umem.c > >>>> @@ -272,11 +272,10 @@ struct ib_umem *ib_umem_get(struct ib_udata *udata, unsigned long addr, > >>>> > >>>> while (npages) { > >>>> down_read(&mm->mmap_sem); > >>>> - ret = get_user_pages(cur_base, > >>>> + ret = pin_longterm_pages(cur_base, > >>>> min_t(unsigned long, npages, > >>>> PAGE_SIZE / sizeof (struct page *)), > >>>> - gup_flags | FOLL_LONGTERM, > >>>> - page_list, NULL); > >>>> + gup_flags, page_list, NULL); > >>> > >>> FWIW, this one should be converted to fast as well, I think we finally > >>> got rid of all the blockers for that? > >>> > >> > >> I'm not aware of any blockers on the gup.c end, anyway. The only broken thing we > >> have there is "gup remote + FOLL_LONGTERM". But we can do "gup fast + LONGTERM". > > > > I mean the use of the mmap_sem here is finally in a way where we can > > just delete the mmap_sem and use _fast > > > > ie, AFAIK there is no need for the mmap_sem to be held during > > ib_umem_add_sg_table() > > > > This should probably be a standalone patch however > > > > Yes. Oh, actually I guess the patch flow should be: change to > get_user_pages_fast() and remove the mmap_sem calls, as one patch. And then change > to pin_longterm_pages_fast() as the next patch. Otherwise, the internal fallback > from _fast to slow gup would attempt to take the mmap_sem (again) in the same > thread, which is not good. :) > > Or just defer the change until after this series. Either way is fine, let me > know if you prefer one over the other. > > The patch itself is trivial, but runtime testing to gain confidence that > it's solid is much harder. Is there a stress test you would recommend for that? > (I'm not promising I can quickly run it yet--my local IB setup is still nascent > at best.) If you make a patch we can probably get it tested, it is something we should do I keep forgetting about. Jason