Received: by 2002:ac0:8bc7:0:0:0:0:0 with SMTP id o7csp87027ima; Wed, 6 Feb 2019 21:40:17 -0800 (PST) X-Google-Smtp-Source: AHgI3IYTubG/HtaGmSaE6eAEZZFv8egt2tvM/bIL2QkEstMWkZDYSEYS4nOqpVg/xoLdEfGl0+/a X-Received: by 2002:aa7:81d0:: with SMTP id c16mr14357099pfn.153.1549518017200; Wed, 06 Feb 2019 21:40:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549518017; cv=none; d=google.com; s=arc-20160816; b=Tj352ymU3xWN/R3HOJ4SJEWos+the57vVt5Osjp7If3I+Be15M69hwAGdiV7L4vEb7 uvxWXC+biX51ucwWenmf+irkQiWXmKgKwuQE9LHbNh+UH+l31iCZF97J4E+nsYb4h8Mo OLHCPo41NqaXnQsyDOZG++fs9khD9wyU7QJ+4ia/PVJVGPd+CNRuqKh0+quEbL7uPdgY O0ePMva6KzTmw9sbMPAKb9vdievmPwzFC6EZr8FAoGhYpRMZ2pJgNCxTYrJCfd/xxjIX BEKvjEzO5i/vhbzypvG53sHD8HYlUyKblPmBoCWO6GwsDhn312DsmenktveGYFos4ksD a7tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=XTzdyLtai2BUGlbOWdmDrFpkGiuimymKU9xYTKalbrg=; b=B0IxeUxhYwLLrxSKlEttl1HOdBGce/9H8+ZfRsmnm/SdxKqDhOvWSbGIvgxWlbK20F rvYyj9kJ99IcQtj9sB7rHHekT+KgeiJVu36FurURSzDcRIhuLLBcMwcdpepbDYPdHn/7 Koq1zqXvzLPT03Jw5lzoraTjCOgZmJEkJmhOaYDwJhFJkHG+4wXcNsM8Smaps4OSkJ9a VUx0Ahatsb+T97UfUMPnf7hqBThvK8qiRr+HHR9HnMiGXTs0pJw3zPOEnMhBg22ISScG wLV7k5325SD6wnaRzDf6/Nf2B/ogyMqPdoqMZg7VFtv9znYArpRYFqYi9m1zbbs4S8BQ d2HQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a124si8627672pfb.263.2019.02.06.21.40.01; Wed, 06 Feb 2019 21:40:17 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726905AbfBGFii (ORCPT + 99 others); Thu, 7 Feb 2019 00:38:38 -0500 Received: from smtp.nue.novell.com ([195.135.221.5]:51265 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726128AbfBGFih (ORCPT ); Thu, 7 Feb 2019 00:38:37 -0500 Received: from emea4-mta.ukb.novell.com ([10.120.13.87]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Thu, 07 Feb 2019 06:38:36 +0100 Received: from localhost.localdomain (nwb-a10-snat.microfocus.com [10.120.13.201]) by emea4-mta.ukb.novell.com with ESMTP (TLS encrypted); Thu, 07 Feb 2019 05:38:02 +0000 From: Davidlohr Bueso To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, dave@stgolabs.net, linux-kernel@vger.kernel.org, "David S . Miller" , Bjorn Topel , Magnus Karlsson , netdev@vger.kernel.org, Davidlohr Bueso Subject: [PATCH 1/2] xsk: do not use mmap_sem Date: Wed, 6 Feb 2019 21:37:39 -0800 Message-Id: <20190207053740.26915-2-dave@stgolabs.net> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190207053740.26915-1-dave@stgolabs.net> References: <20190207053740.26915-1-dave@stgolabs.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 = get_user_pages(umem->address, umem->npgs, - gup_flags, &umem->pgs[0], NULL); - up_write(¤t->mm->mmap_sem); + npgs = get_user_pages_fast(umem->address, umem->npgs, + gup_flags, &umem->pgs[0]); if (npgs != umem->npgs) { if (npgs >= 0) { -- 2.16.4