Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4283286ybv; Mon, 10 Feb 2020 16:16:13 -0800 (PST) X-Google-Smtp-Source: APXvYqzjXtW07DK0eNPGl+gpemlwg1B+mj61FhUlvh/s3nt9ECS0Te+libItDjvFWkwP2ItMbBkZ X-Received: by 2002:a05:6830:13d9:: with SMTP id e25mr3107005otq.134.1581380173222; Mon, 10 Feb 2020 16:16:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581380173; cv=none; d=google.com; s=arc-20160816; b=cH7reEFphKUfRYgioUZGLzeDfkM8dypwQ1iwfoi4BJ/Vpoot2T/A1/+FD1lW+RNNa5 1v3VbfRtv+ugVZF/zHzNi1KleYbLHsy5CYC0TCzwgJmV3GfeGoaQvjT5PbR6q8bNj42N g9lUZVCZFibuaVYOSxgVbseF5Pjx6/YN9wOkJc5zGkN/AU+PIefaS0s+tHHaL9qKAC3i t3PVxSAxa23DP07xeo/9K/WVnvD+DxnBRiaf87jCrzNLYLEEBtuUTLU8Numjl8QmRwNh 2UoxO2VDpxinLbU5GDcpwrZuYs2asXB5ya5UKeVPHSAIr7cdOEcI3i8SOT2kM9UYdjHU 9GSQ== 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=9vUvR7MWlrDY2h3QHPZ14a3zjGRWS++CvrjGW0mNfqY=; b=McDS1GLcb19b5isprk17fLdo1Dk3ZS7DqnDd721j7sr478FBkh5Z7ka4Tino9YH2bY IYHUvl4mdbTpg0guVtU5yiK+2FzUissfZTCCRsM4vGqLuIxpyrE3kjGxYuKaUUBvaRZy T867P79XVfgfVYW5U/Er5BxLtSludq/RXyLFmTy+BSxSIbCArbkt/HIBvBBV4el/EjtY 7QZpGH/LnesY616hR5eTpcVc10qv28LZteNrFxiYC+fxrqtOv7Rf0Fymemau5najLFh2 B0NTHyc3qU9KY4YBOeNYwEAIC7YzxrlnTCZzmdOl28Iix36BAoDu93TxOo5306q3Vrhm cTuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=hglMjuCC; 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 l10si1054894oth.243.2020.02.10.16.16.00; Mon, 10 Feb 2020 16:16:13 -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=hglMjuCC; 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 S1727726AbgBKAPn (ORCPT + 99 others); Mon, 10 Feb 2020 19:15:43 -0500 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:4281 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727668AbgBKAPm (ORCPT ); Mon, 10 Feb 2020 19:15:42 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 10 Feb 2020 16:14:35 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 10 Feb 2020 16:15:38 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 10 Feb 2020 16:15:38 -0800 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 11 Feb 2020 00:15:37 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 11 Feb 2020 00:15:37 +0000 Received: from blueforge.nvidia.com (Not Verified[10.110.48.28]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 10 Feb 2020 16:15:37 -0800 From: John Hubbard To: Andrew Morton CC: Al Viro , Christoph Hellwig , Dan Williams , Dave Chinner , Ira Weiny , Jan Kara , Jason Gunthorpe , Jonathan Corbet , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , "Kirill A . Shutemov" , Michal Hocko , Mike Kravetz , Shuah Khan , Vlastimil Babka , Matthew Wilcox , , , , , , LKML , John Hubbard , "Kirill A . Shutemov" Subject: [PATCH v6 02/12] mm/gup: pass a flags arg to __gup_device_* functions Date: Mon, 10 Feb 2020 16:15:26 -0800 Message-ID: <20200211001536.1027652-3-jhubbard@nvidia.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200211001536.1027652-1-jhubbard@nvidia.com> References: <20200211001536.1027652-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1581380075; bh=9vUvR7MWlrDY2h3QHPZ14a3zjGRWS++CvrjGW0mNfqY=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:X-NVConfidentiality: Content-Type:Content-Transfer-Encoding; b=hglMjuCCYEGU0yZbY0/BPbJq4WZ9o9Q5NLX4SCaR+x2jgXCKSDaP+jTdmyV1QdEFv 22PeL91w5TJie8gGLTliMTLTsxi1lcEsg2iIrfH3HkWpKRhznH2uxT3SnHsYecigfE lG0bUQoBejWhNDJArjM4gN9TqTgTLrPGJTe1Z1ENDiPmStScEguN95g5k5LZ74Xnfa 2HdrcUOE3iIx3KUNt5uhf4tkktv5tZM2LNXCSlDiOJt6NRzrRAQWL1gIwWO4do7O2W Dt/0wia46hSMMbP6QqrOjNunpYszmb08i7fXSz07YlOrA4HcSzxh+fvjyaqoMcfqXM 7wylm7FMPrSBQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A subsequent patch requires access to gup flags, so pass the flags argument through to the __gup_device_* functions. Also placate checkpatch.pl by shortening a nearby line. Reviewed-by: Jan Kara Reviewed-by: J=C3=A9r=C3=B4me Glisse Reviewed-by: Ira Weiny Acked-by: Kirill A. Shutemov Signed-off-by: John Hubbard --- mm/gup.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index b699500da077..9e117998274c 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1963,7 +1963,8 @@ static int gup_pte_range(pmd_t pmd, unsigned long add= r, unsigned long end, =20 #if defined(CONFIG_ARCH_HAS_PTE_DEVMAP) && defined(CONFIG_TRANSPARENT_HUGE= PAGE) static int __gup_device_huge(unsigned long pfn, unsigned long addr, - unsigned long end, struct page **pages, int *nr) + unsigned long end, unsigned int flags, + struct page **pages, int *nr) { int nr_start =3D *nr; struct dev_pagemap *pgmap =3D NULL; @@ -1989,13 +1990,14 @@ static int __gup_device_huge(unsigned long pfn, uns= igned long addr, } =20 static int __gup_device_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long ad= dr, - unsigned long end, struct page **pages, int *nr) + unsigned long end, unsigned int flags, + struct page **pages, int *nr) { unsigned long fault_pfn; int nr_start =3D *nr; =20 fault_pfn =3D pmd_pfn(orig) + ((addr & ~PMD_MASK) >> PAGE_SHIFT); - if (!__gup_device_huge(fault_pfn, addr, end, pages, nr)) + if (!__gup_device_huge(fault_pfn, addr, end, flags, pages, nr)) return 0; =20 if (unlikely(pmd_val(orig) !=3D pmd_val(*pmdp))) { @@ -2006,13 +2008,14 @@ static int __gup_device_huge_pmd(pmd_t orig, pmd_t = *pmdp, unsigned long addr, } =20 static int __gup_device_huge_pud(pud_t orig, pud_t *pudp, unsigned long ad= dr, - unsigned long end, struct page **pages, int *nr) + unsigned long end, unsigned int flags, + struct page **pages, int *nr) { unsigned long fault_pfn; int nr_start =3D *nr; =20 fault_pfn =3D pud_pfn(orig) + ((addr & ~PUD_MASK) >> PAGE_SHIFT); - if (!__gup_device_huge(fault_pfn, addr, end, pages, nr)) + if (!__gup_device_huge(fault_pfn, addr, end, flags, pages, nr)) return 0; =20 if (unlikely(pud_val(orig) !=3D pud_val(*pudp))) { @@ -2023,14 +2026,16 @@ static int __gup_device_huge_pud(pud_t orig, pud_t = *pudp, unsigned long addr, } #else static int __gup_device_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long ad= dr, - unsigned long end, struct page **pages, int *nr) + unsigned long end, unsigned int flags, + struct page **pages, int *nr) { BUILD_BUG(); return 0; } =20 static int __gup_device_huge_pud(pud_t pud, pud_t *pudp, unsigned long add= r, - unsigned long end, struct page **pages, int *nr) + unsigned long end, unsigned int flags, + struct page **pages, int *nr) { BUILD_BUG(); return 0; @@ -2146,7 +2151,8 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsi= gned long addr, if (pmd_devmap(orig)) { if (unlikely(flags & FOLL_LONGTERM)) return 0; - return __gup_device_huge_pmd(orig, pmdp, addr, end, pages, nr); + return __gup_device_huge_pmd(orig, pmdp, addr, end, flags, + pages, nr); } =20 page =3D pmd_page(orig) + ((addr & ~PMD_MASK) >> PAGE_SHIFT); @@ -2167,7 +2173,8 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsi= gned long addr, } =20 static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr, - unsigned long end, unsigned int flags, struct page **pages, int *nr) + unsigned long end, unsigned int flags, + struct page **pages, int *nr) { struct page *head, *page; int refs; @@ -2178,7 +2185,8 @@ static int gup_huge_pud(pud_t orig, pud_t *pudp, unsi= gned long addr, if (pud_devmap(orig)) { if (unlikely(flags & FOLL_LONGTERM)) return 0; - return __gup_device_huge_pud(orig, pudp, addr, end, pages, nr); + return __gup_device_huge_pud(orig, pudp, addr, end, flags, + pages, nr); } =20 page =3D pud_page(orig) + ((addr & ~PUD_MASK) >> PAGE_SHIFT); --=20 2.25.0