Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp42178imj; Wed, 6 Feb 2019 23:43:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IbQLwsuVLJ0wtr2HIrrwsr8L5JusbaIG5G0yBBblIuuQrOPFUuRkXX1AnduQ2l2p+9blc+g X-Received: by 2002:a63:d90b:: with SMTP id r11mr13616064pgg.5.1549525424286; Wed, 06 Feb 2019 23:43:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549525424; cv=none; d=google.com; s=arc-20160816; b=x4wYXWW4xyWUnhBrOSYiSNJM/VAvZ7Z8ePQMRxsWXw+hPhsio4YGkYYgEwPsjcJlNh /FVwTfrM5Jr5Rbzxnw17RSJEXBt1Qhc8RyL1V+m1GAnOlezcG7cXvcWhxjOx9hAemqKK auujBC/FUMC8j2iELVZFtBf7zVPDjCh6NiSLZquIpThi5f+BJF13wC9qt7GaQQKramxT QuKjtGsQbjgrnxnxA+qKXLglxYlSBoNQxozCBMYgVIr25WvMWqi/9Ga82NBmrKWDxUXj 9Jl6MYpRaLFdUs9ayzjRgRgsjVIJEAjcpgxsYTnNFkBlT7P1gi6eei6gHnQvRj+plhgT jZcA== 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=hgWiPuQktGDPbFQrOQ3Zw6WnbDS/jHeyLQ4R4JqPa1k=; b=dKupmkwunpwK16vPlsmYP+Y6bzOYosOg581IpFQ2nZSPmgW/QlW8zXZ0giMvCfSl7w AGSvQPgPkqBPlIGMVKePm33SLPpglOY74zG0O2COqK3AmYeJiB6Y7WynR2xJ8Z/GSdcI fd+Hp99triC8tGFm1ZSxzruFq0YASPdXzY9SAaM4E98bpUKJuCJyfDtOt60wd+rTugBh nOyC7OPHoIMMmdrlWhiSclUyMAf6esQ8Wt3h7j3o1RZRl0LjyI67M23m7j/0X1LB0Hge anXYhxNR33My6ZYwt4nIS31MR/iIBCX21V47M/L7iW7HNmQ+4ogQ/VAPQfKj9n++TA0M ft8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sFQS50W9; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9si2116051plq.337.2019.02.06.23.43.29; Wed, 06 Feb 2019 23:43:44 -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=@gmail.com header.s=20161025 header.b=sFQS50W9; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726952AbfBGHnP (ORCPT + 99 others); Thu, 7 Feb 2019 02:43:15 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:42964 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726410AbfBGHnP (ORCPT ); Thu, 7 Feb 2019 02:43:15 -0500 Received: by mail-qt1-f196.google.com with SMTP id b8so10911026qtr.9; Wed, 06 Feb 2019 23:43:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=hgWiPuQktGDPbFQrOQ3Zw6WnbDS/jHeyLQ4R4JqPa1k=; b=sFQS50W9xOhD0g+DL/NQVoLqngbI0oniG4ARw3FONq4btMQmjVPCfS42/cOhgliKff mHNiWREzOlNAZQQfB6khK4OXLyIVNU1rGp1rC8pYQO2Ya0HHmKAgI8Eavkcfuy55ml52 4olKvAZxp5sN4kexTIBg1uJWLSig2IxB4KSEnMqjYAT8HqAufCATorfSWA1Ao3SjSw3+ 43GvsJRzNyGZUiP9mOD8SxFKHP0lloRYV/lP3gCiNYwtpneDOFTPsilQvoHf8xTrr9jD yNI5rYE4CQQn8CXTriDBXZ/XFInKCk6BrP2/na8mpXw6X/5tobMJ4p8gBT8ORaXuevud g7Gw== 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=hgWiPuQktGDPbFQrOQ3Zw6WnbDS/jHeyLQ4R4JqPa1k=; b=dpCssAd0XFt9KYWagSH2DzoUZ0RKrSMtp82U9waDb/z3V0oUOUvLtNWM98/PBbEBGJ oaSM5UU2j0sRxUeREjnZ4kT+Lnk5y93nC4m5NtxzN58me1zAsK0VxNt1Rt0D9pldMMPn U58cWp6AtIS1dyp9A1XEooEvWjmLQyk7j63i+BHuhut297y5/x+TeMM4xTSJ/hBpgU6b jqWZXTj/mWjXdwB+e1GczSqbhcxP+7vcA6EoSq09H4Zz6LQvrhfzQtBNkXYXkdvRsPEd gSoDPSpZj2iKvSXOSNTZX4rtljSOxBWF4WnXHQW/NBEg6bvfS3qUbMvD1k9BvnnCpOCW UWHg== X-Gm-Message-State: AHQUAua+/kleOCeqL+lisaq+H2bN//kjTR0Vwe3dhvgXSXlaAIPYObYN Mr46BiL4jrVYdRjyu/qKD7cvp0uacODwm1Mv1pE= X-Received: by 2002:ac8:4453:: with SMTP id m19mr855654qtn.303.1549525393551; Wed, 06 Feb 2019 23:43:13 -0800 (PST) MIME-Version: 1.0 References: <20190207053740.26915-1-dave@stgolabs.net> <20190207053740.26915-2-dave@stgolabs.net> In-Reply-To: <20190207053740.26915-2-dave@stgolabs.net> From: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= Date: Thu, 7 Feb 2019 08:43:02 +0100 Message-ID: Subject: Re: [PATCH 1/2] xsk: do not use mmap_sem To: Davidlohr Bueso Cc: akpm@linux-foundation.org, linux-mm@kvack.org, LKML , "David S . Miller" , Bjorn Topel , Magnus Karlsson , Netdev , Davidlohr Bueso 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 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 *umem) > 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? Bj=C3=B6rn > if (npgs !=3D umem->npgs) { > if (npgs >=3D 0) { > -- > 2.16.4 >