Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp247907ybc; Tue, 19 Nov 2019 00:20:59 -0800 (PST) X-Google-Smtp-Source: APXvYqyQYKrN/49vkWYmtAtZsvElhhFJPo3d73TEkkNrr9sXdrkaHeIpHQHhCLAlekbjS5dv7oji X-Received: by 2002:a17:906:8548:: with SMTP id h8mr33106544ejy.290.1574151659162; Tue, 19 Nov 2019 00:20:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574151659; cv=none; d=google.com; s=arc-20160816; b=ucn5ZceCwuyoJgktk2QQEc6XcBc2PE85izzEn+w7vrCQYBeNhDmYjkhh31AbtSttzO QQuqdi8cULMBY6Pf3tCi9NO5BEB0n8ugUnv31zqJEPK0qvw9aZfNKYNU0lAssDdeGDOs dcDcfHU4ROXtP893Lxp2CADdyHurOLwxfGzQUHpUfCBj56956+274JgqZ0d4YUpnwnNM SttmNnUu4B8lHsOP2dF9J6Ie0BXIlI1yp2R3VF6idYj51QSs7nm9uvAsDJzemhxMWbP2 yZ97ZfAbv6Yku1dRPGIj6XKsPlOfrYrIAttiGusIDth9KpgtqWGSVOiQST+7W+DLJOy0 JGLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=FCIP8u2MkE9GuwCE1S6XwDB40Ef75NYaz/rgUHY6mDg=; b=fgyEA2QOO23MKrDNghs2jH0hTFT2TY9oK3w2T1Uklb3O8nUHHrmKCoVTJDBgcDOT9J zN/wN2x06xSKYEnwAq7Fyk0NCU0dIpyzhPUETejR8AHbcvSM/NYafnUMkz/Ev4F6sO9F XRvUXLdtJ7Wr1PfsM1DomiPPTa8juGz2ICDz6Jq/E9ljjtcH+QjHO/HwcT1smySs4vQ1 dUfleKhhSr06B7uzlEWaOaRd3zOMxNJKzQJCwY2X75uRJKnJXqCIZ19PZ4eMlzr7iFLb d4a9mzyPI+f8wuGDwyIN0tRBnZaZlPuk0HGFaHwEB8LZO7ID1qO2iv/P/Vad3ykJASdd dtag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=QxFBxuhH; 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=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w57si15857228eda.78.2019.11.19.00.20.35; Tue, 19 Nov 2019 00:20:59 -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=@nvidia.com header.s=n1 header.b=QxFBxuhH; 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=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728187AbfKSISx (ORCPT + 99 others); Tue, 19 Nov 2019 03:18:53 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:12831 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727738AbfKSIRJ (ORCPT ); Tue, 19 Nov 2019 03:17:09 -0500 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 19 Nov 2019 00:17:06 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Tue, 19 Nov 2019 00:17:05 -0800 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Tue, 19 Nov 2019 00:17:05 -0800 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 19 Nov 2019 08:17:04 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 19 Nov 2019 08:17:03 +0000 Received: from blueforge.nvidia.com (Not Verified[10.110.48.28]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Tue, 19 Nov 2019 00:17:03 -0800 From: John Hubbard To: Andrew Morton CC: Al Viro , Alex Williamson , Benjamin Herrenschmidt , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Christoph Hellwig , Dan Williams , Daniel Vetter , Dave Chinner , David Airlie , "David S . Miller" , Ira Weiny , Jan Kara , Jason Gunthorpe , Jens Axboe , Jonathan Corbet , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Magnus Karlsson , Mauro Carvalho Chehab , Michael Ellerman , Michal Hocko , Mike Kravetz , Paul Mackerras , Shuah Khan , Vlastimil Babka , , , , , , , , , , , , , LKML , John Hubbard Subject: [PATCH v6 15/24] fs/io_uring: set FOLL_PIN via pin_user_pages() Date: Tue, 19 Nov 2019 00:16:34 -0800 Message-ID: <20191119081643.1866232-16-jhubbard@nvidia.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119081643.1866232-1-jhubbard@nvidia.com> References: <20191119081643.1866232-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: quoted-printable Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1574151426; bh=FCIP8u2MkE9GuwCE1S6XwDB40Ef75NYaz/rgUHY6mDg=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:X-NVConfidentiality: Content-Transfer-Encoding:Content-Type; b=QxFBxuhHjKCd6xNfcPw714J6EUGTw47Qo+sFTbaAXfcOMWbP9nj66BnYkTZYQoFWr sa+z2ONd+QwazY9DpECjmgaAUJZvQAZI89Z+rZsX6+eqyYGtTuPlBXPYBRutu5ToIe 9PGit/nSKXD70oeQYHSAggqqNUjEp8CXUWIZhi9AOCXe2tgl5dQly9rGaQlxWuHu+e iGgnHFVSj/ClcyNb6JmUlDDb8bGTcQ6M2qlDITM0q33JuxZwsDcnYxO85xhemWF/Bp NDILL483XIyDub71Z8bdBIMGiLEMsEf5FFlowCaw8K6pN7U9c638Rjd9SD4663IEKP iwWjOyFXFjZDw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert fs/io_uring to use the new pin_user_pages() call, which sets FOLL_PIN. Setting FOLL_PIN is now required for code that requires tracking of pinned pages, and therefore for any code that calls put_user_page(). In partial anticipation of this work, the io_uring code was already calling put_user_page() instead of put_page(). Therefore, in order to convert from the get_user_pages()/put_page() model, to the pin_user_pages()/put_user_page() model, the only change required here is to change get_user_pages() to pin_user_pages(). Reviewed-by: Jan Kara Signed-off-by: John Hubbard --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 2c819c3c855d..15715eeebaec 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3449,7 +3449,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx = *ctx, void __user *arg, =20 ret =3D 0; down_read(¤t->mm->mmap_sem); - pret =3D get_user_pages(ubuf, nr_pages, + pret =3D pin_user_pages(ubuf, nr_pages, FOLL_WRITE | FOLL_LONGTERM, pages, vmas); if (pret =3D=3D nr_pages) { --=20 2.24.0