Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2782806imj; Mon, 11 Feb 2019 08:23:35 -0800 (PST) X-Google-Smtp-Source: AHgI3IZMZiY6GdATHmG0H5jAT6q3NTronnCCufUMiKeRw1IgZdyJoJqTitmfQx7euGAVBqnCTkVd X-Received: by 2002:a63:da14:: with SMTP id c20mr32981764pgh.233.1549902215169; Mon, 11 Feb 2019 08:23:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549902215; cv=none; d=google.com; s=arc-20160816; b=Ok/CYkH22jwyzqxLwIczICTPzIvbBx56mQiwYu8vYC8mE1GLd7V/rl/e9hG36yrPXS kWZrvR0hObLEwB9XmGAuXM2nP9IoXzOpremSRvr06nP3RCb88lHPO/KkBfSjSrrEhAj8 df0M5lisOqm0IQ93kvwTekfIw1Ib4wr42Pj0TPoUSX91jSHoGrJl1bw7sZATyKoLyj1P l2Iget8NB2AOBi3FBEvhukdB3zTFL2v17ARB3KaB9ytuSPnup89ngV8bixjbMMBSB2Hz 9i3NSQCOx6jc5BNSAL3eZJ5xQGnRwJhjPUVYJBYU6flsAkvx/UxyvGpa9F2Yxg1IsPRW uoQQ== 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:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=cW7tWR8jGU6zZ9qwHpZvVc4mElp1JZn1A2mPsX4Px5E=; b=nv4gDbj9cr94n1Gk2ycVKQu7lwy0CgSNgkcp8ReWkKgvP23FIwqRT51ZkQp9lE7puo LS/oS7KSTR+6dF9xXkR+MRs5brJFZTpGDGYzMZjIHb1jG2eiJyItv8V5JQJhMlTGz5bk X+KqKT48EAYn8fQWupncSh9LXU8hyO9lv6qx/gZSoEmS/5WCceVo5x5b7SBKoQJBxxbm StIH3ECH1I/Ua1b9Wim4wwPteyPj7GanFxQejBkGLG0qmPvcyKh+n8XjHBOqvwGbSOcy IBhQt50SP9ZzowxAc9pYyuPdeMzApRxEVqJK8r6qr4MHemuhWruscWq/1bJCzhX6E1UI 2H8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jkXD9mqf; 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 b8si807791ple.5.2019.02.11.08.23.17; Mon, 11 Feb 2019 08:23:35 -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=jkXD9mqf; 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 S1728529AbfBKQWD (ORCPT + 99 others); Mon, 11 Feb 2019 11:22:03 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:42028 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726941AbfBKQWC (ORCPT ); Mon, 11 Feb 2019 11:22:02 -0500 Received: by mail-qk1-f195.google.com with SMTP id y140so6743461qkb.9; Mon, 11 Feb 2019 08:22:02 -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 :content-transfer-encoding; bh=cW7tWR8jGU6zZ9qwHpZvVc4mElp1JZn1A2mPsX4Px5E=; b=jkXD9mqfWW3yXbG8w0LZFxPfA2yQmsA507fb3oPSKudLwSr06rY7lKpkWsvp8gyDJn mje9T/31t+keyaV3PDToa5jAAqyUX0WsaHAXW8uu5aNkYlsraE48lbYzzv6U9yDLV4DE D1bba6Y9KgNsImsmZRm+vMjRY41YyAa9YO9js9RqBukfHHYtFTWkW98IqIoxCMaMN/Jy vVWRtyqmN6jy+0UPJTNdAW1oupFbp1TsG5ZjpU0A2TY+Fxr9Qs3klWX3R0VgbUdMWgAz CME4zS9naGnbE6twvA7xihqe1qIy1F+npUtRSk0Xs6lBYc9TlTuXH6bKsmQ7IHT+f8z0 ppVA== 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:content-transfer-encoding; bh=cW7tWR8jGU6zZ9qwHpZvVc4mElp1JZn1A2mPsX4Px5E=; b=PM61GKxT0PsaSXt5aBfDDF6IrolxV6Jbj28Nh4NcihakQPAYERhv0LbExMho7rvHUR uJ3CsxN0NT4FVwKWsXeSV37f6CpkcbDpBTLkT9RWAijrdj6eywwjX6bXa7BlFLw6bmod r3wmUwZRRJ1fyj/P9a7I/LWjL7LFJbENEu7yYqwFb0EcrE5LO46tCHNaxnBEZmRc6aUY 8Rp9IOUoxHvR60Lr8FH8s2x2OjLriRFGvyKgDKxJNtb6qUXpzJJaFTN5N7Bz9B5OaBmb HTgOPJCJpMkunmKHzVmda6BQrXTx40cv5sLltMYxrtldgqsN7KocSEM/27kgY9lvZTPR Rk/w== X-Gm-Message-State: AHQUAuYZ0GnvBJmVmltCiRUgFxUQB/RirNFR3GtNnrmv5SuX5DC4dqBW ve6aSSj74DQg/XGeKeYWuutGx6ZwO0OZbzBi+O4= X-Received: by 2002:a37:5807:: with SMTP id m7mr26465615qkb.141.1549902121590; Mon, 11 Feb 2019 08:22:01 -0800 (PST) MIME-Version: 1.0 References: <20190207053740.26915-1-dave@stgolabs.net> <20190207053740.26915-2-dave@stgolabs.net> <20190211161529.uskq5ca7y3j5522i@linux-r8p5> In-Reply-To: <20190211161529.uskq5ca7y3j5522i@linux-r8p5> From: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= Date: Mon, 11 Feb 2019 17:21:49 +0100 Message-ID: Subject: Re: [PATCH v2] xsk: share the mmap_sem for page pinning To: 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 m=C3=A5n 11 feb. 2019 kl 17:15 skrev Davidlohr Bueso : > > Holding mmap_sem exclusively for a gup() is an overkill. > Lets share the lock and replace the gup call for gup_longterm(), > as it is better suited for the lifetime of the pinning. > Thanks for the cleanup! Acked-by: Bj=C3=B6rn T=C3=B6pel > 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, 3 insertions(+), 3 deletions(-) > > diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c > index 5ab236c5c9a5..e7fa8d0d7090 100644 > --- a/net/xdp/xdp_umem.c > +++ b/net/xdp/xdp_umem.c > @@ -265,10 +265,10 @@ 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, > + down_read(¤t->mm->mmap_sem); > + npgs =3D get_user_pages_longterm(umem->address, umem->npgs, > gup_flags, &umem->pgs[0], NULL); > - up_write(¤t->mm->mmap_sem); > + up_read(¤t->mm->mmap_sem); > > if (npgs !=3D umem->npgs) { > if (npgs >=3D 0) { > -- > 2.16.4 >