Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2800072imj; Mon, 11 Feb 2019 08:39:57 -0800 (PST) X-Google-Smtp-Source: AHgI3Iaz1D16zaXJT1VYPUrzYUjkV7Oi6GWZ7u+C0DC7fYVINMQE32qg2I+fQ/nIYffmNSToD0bp X-Received: by 2002:a65:64d9:: with SMTP id t25mr1204350pgv.244.1549903197000; Mon, 11 Feb 2019 08:39:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549903196; cv=none; d=google.com; s=arc-20160816; b=Rvmr0xI4J+c2ZMRmC9JTr5qRWR2X7IYRC/oFCEzfcQtjGt13Lp803AjN4+5/Law7zX Yyd8MkKhzLUpsSv7bm0SBXjMuBLMrxsCr/WBkXeXUCHp/eA9BBRFmQeSU6VtXqHXmpRi Kxw1lICumUv1X/PhV/TfM6KWYEPW94wkHwGugH0qDUaeHwJhvADCO1TAlwRpu59NAdTn X/J+PHvBxtxnUd05FDY3KtU1IRLMv8sogFsnyBkq39uXouNqtqU15S9NebXUu2B4jgyi ztXuiepTfQXCfxX1nbERClezILpuGgNB4Gv0S6K0AWj+7Wur+RtJQbushM1jOKlXtg5W pMlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=y+WgygOtpVO0gM+ieHP6u5F87v+TX254wZk88lkZFfs=; b=gvPp5KtQmSH+AwUVGv2akj9SLch2m19IqpPB6Z267DTItSCBOEj9rmv9yX3sGgmvBp wYxMvkxShC+ve1rn5Gd4wwT1tskBaVb+iFaMsoI5/d0UwrclkxJR7bh+J2UyYq8ctMPd bjVKN90mRbLBeCTkWjKSVIueiXnNzCoYbVEuAzeKX6LZQNps0JWE13/HNXa1PKEj7Bp6 mVceZYRXV8pY1wVNRoYRptavKDsLNv7QQ/Jhmu/JbVtaCmYo6fJ5AToNh8WM+teLQJ46 94mnBThnCvMyDjA9sr/0rTBbB0cIVq6qMnsPzpCGVeh+bRUeq6agJp/wvpX986+8RiEo 8F9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=SqiX0il2; 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 w13si10739ply.264.2019.02.11.08.39.40; Mon, 11 Feb 2019 08:39:56 -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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=SqiX0il2; 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 S1728463AbfBKQhy (ORCPT + 99 others); Mon, 11 Feb 2019 11:37:54 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:44611 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729019AbfBKQhx (ORCPT ); Mon, 11 Feb 2019 11:37:53 -0500 Received: by mail-ot1-f66.google.com with SMTP id g1so4559905otj.11 for ; Mon, 11 Feb 2019 08:37:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=y+WgygOtpVO0gM+ieHP6u5F87v+TX254wZk88lkZFfs=; b=SqiX0il20523leaUZO7Dw38Xu6z7Ct3I5gNH6tsjk3SOor7NXieso6+6knlODFRARF +MHzR/xdvbH+lUfNPEsFyVg87HaKR4Gi14Mow0TyNFpvFS83EiuNkX6ZoiBUzVAgH6sF RAjC4zMoteQ3fN9s64bFKc0qhLk/MjDv8y8oewpW+lS8EqpgtCsh2H6V9/M5+n/p6Hi/ jdQVVb88/YWQfTQG8G9M/fBD6MAQR9wHHheEu6OMHlGl2XiHlN3Ivecg9a9V+RM18GNi 5D5HZ6heq54TbMRG21sWsB9jDVp/9nMCp5aoaQ+PxIOeedIkU3FXKZ87AdUZ4/VhL/T8 cQDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=y+WgygOtpVO0gM+ieHP6u5F87v+TX254wZk88lkZFfs=; b=RkghCwTwztVd4ChAuzkz7y1iWErHw/g30Qb7Rq6MOkznjf7y8bXWews0pLKDo/EZU+ QG76WyvpCzI/8VXxn4lwdQed3NUZjR1bO4FHft50rOpaNMZYIiwION1+TffgNTfk2zsO gWzXItoUoGd1+DFwAAVfHHVSO9TEnBQXvdDvMVZhm9s4BQIe/kN6cOm13JomgxV1utTh I7Ag/+gN7CZrdO6ywqo8L07qpjtRrgDWyHi/vTmh62aS9h4Xv3cVT7C76dMaSGKv9Peu LTxyVvoClGYNLRiL7YN3qC1s1hSm9+n7P/YczDQ+gvObWgQNurZ+NQKwKb+rWW1DcWrW QzhA== X-Gm-Message-State: AHQUAuYlAazH1U3YZpxh/zPIAKRqCaiYRMXuS5J8L0v02WT1h2l/fKFc rz7n3/KLFqr0F2zSWCSHCkLxOqAdF9pNsgfcIV3U/Q== X-Received: by 2002:a05:6830:1c1:: with SMTP id r1mr12257432ota.229.1549903072090; Mon, 11 Feb 2019 08:37:52 -0800 (PST) MIME-Version: 1.0 References: <20190207053740.26915-1-dave@stgolabs.net> <20190207053740.26915-2-dave@stgolabs.net> In-Reply-To: From: Dan Williams Date: Mon, 11 Feb 2019 08:37:41 -0800 Message-ID: Subject: Re: [PATCH 1/2] xsk: do not use mmap_sem To: Daniel Borkmann Cc: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Davidlohr Bueso , Andrew Morton , Linux MM , LKML , "David S . Miller" , Bjorn Topel , Magnus Karlsson , Netdev , Davidlohr Bueso , "Weiny, Ira" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ add Ira ] On Mon, Feb 11, 2019 at 7:33 AM Daniel Borkmann wrot= e: > > [ +Dan ] > > On 02/07/2019 08:43 AM, Bj=C3=B6rn T=C3=B6pel wrote: > > Den tors 7 feb. 2019 kl 06:38 skrev Davidlohr Bueso = : > >> > >> Holding mmap_sem exclusively for a gup() is an overkill. > >> Lets replace the call for gup_fast() and let the mm take > >> it if necessary. > >> > >> Cc: David S. Miller > >> Cc: Bjorn Topel > >> Cc: Magnus Karlsson > >> CC: netdev@vger.kernel.org > >> Signed-off-by: Davidlohr Bueso > >> --- > >> net/xdp/xdp_umem.c | 6 ++---- > >> 1 file changed, 2 insertions(+), 4 deletions(-) > >> > >> diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c > >> index 5ab236c5c9a5..25e1e76654a8 100644 > >> --- a/net/xdp/xdp_umem.c > >> +++ b/net/xdp/xdp_umem.c > >> @@ -265,10 +265,8 @@ static int xdp_umem_pin_pages(struct xdp_umem *um= em) > >> if (!umem->pgs) > >> return -ENOMEM; > >> > >> - down_write(¤t->mm->mmap_sem); > >> - npgs =3D get_user_pages(umem->address, umem->npgs, > >> - gup_flags, &umem->pgs[0], NULL); > >> - up_write(¤t->mm->mmap_sem); > >> + npgs =3D get_user_pages_fast(umem->address, umem->npgs, > >> + gup_flags, &umem->pgs[0]); > >> > > > > Thanks for the patch! > > > > The lifetime of the pinning is similar to RDMA umem mapping, so isn't > > gup_longterm preferred? > > Seems reasonable from reading what gup_longterm seems to do. Davidlohr > or Dan, any thoughts on the above? Yes, any gup where the lifetime of the corresponding put_page() is under direct control of userspace should be using the _longterm flavor to coordinate be careful in the presence of dax. In the dax case there is no page cache indirection to coordinate truncate vs page pins. Ira is looking to add a "fast + longterm" flavor for cases like this.