Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp25853ybv; Tue, 4 Feb 2020 15:42:53 -0800 (PST) X-Google-Smtp-Source: APXvYqwOuZ1znKHeZCIEiFBM4poq2YLhlYtoEI/ttzBwxX3LiZ7GbdiHSe5HuUpQd48i65V9YAhY X-Received: by 2002:a54:4e96:: with SMTP id c22mr1108641oiy.110.1580859773538; Tue, 04 Feb 2020 15:42:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580859773; cv=none; d=google.com; s=arc-20160816; b=rYGstv8BA5/bcOtFRJ6YKeZvyL5LjffP784WRa008teungcYU0FSxaqvht4gorxGhj XtPWwlk7XPoyEoyIfSzHM9J3Ty9QrEFmj5FLzlf9iHdeFATGy/NneI+Gtng99722foRC BejGHC/unnM5+TNp2XhmTME0ELHv57tWPIJOnprOGcnDhFrLa+O7I89W17HdDrXjQ2OZ PNmVgZWk4afUuBFRA5aItr0DKUuGmCrPNAqwFCa7tRAZGhpzhL8V6HfGlAHF171NS+RC i28gX6iDzKstyabKoDDlEl0CvewVhqsYLEF7TbXSfr417yIkMOFxBUysiOifgPG51cUm mv5w== 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=FaYoJvbef/0yTMm61I6cccN5MbEbXutI5GIi1RsfmFLeoPKABuPUIBKMC59Sv8BsCo gDp6UIMDhbCiPHsQgVvLCnRxhJC/Q6H8Jo3Zf6sfILP+4wsWUCkJCZZQXtEkA/BljbCP /NcSGBN0Eo52q+hH1f9QvnlidKk7CyxY5qGXCpCpEJT7nSarfDTLKORBldJCAlNooDS/ Rsf1zhab4BnjAdcTPunmpDCkAFhcAFt99GaxzgZWGyTOxB/avHIxEYbPWIaMCVAp5RP0 +cPEK45L43ziGen+7lHvwXilzaQc+V6V4yt1YieiUo4cp8nYV7ccCsLS4LEPajpzFk8V NOrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=p8YjbzIk; 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 i194si8263833oib.73.2020.02.04.15.42.41; Tue, 04 Feb 2020 15:42:53 -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=p8YjbzIk; 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 S1727846AbgBDXlj (ORCPT + 99 others); Tue, 4 Feb 2020 18:41:39 -0500 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:8943 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727778AbgBDXlZ (ORCPT ); Tue, 4 Feb 2020 18:41:25 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 04 Feb 2020 15:40:23 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 04 Feb 2020 15:41:20 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 04 Feb 2020 15:41:20 -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, 4 Feb 2020 23:41:19 +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, 4 Feb 2020 23:41:19 +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, 04 Feb 2020 15:41:19 -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 v4 03/12] mm/gup: pass a flags arg to __gup_device_* functions Date: Tue, 4 Feb 2020 15:41:08 -0800 Message-ID: <20200204234117.2974687-4-jhubbard@nvidia.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200204234117.2974687-1-jhubbard@nvidia.com> References: <20200204234117.2974687-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=1580859623; 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=p8YjbzIkk8VFgGtipjXipMgU0Ab6mzYuoEHldNteYD5erSn0L9KrnFM11ZMjo1aZ7 zrz6TBZ2CIQvLiPP7jaTr9+0RsqT75cG5N2NHxzopgqPGVVx3MZ/2phABxam+vsVoM WVSdYK596KLdiRN53oa12gQViNbdJ57hLwg1egEF3QYdotCrVVWKmeGyjpkoubAYwL kGQXiWClXA1LEByiZaEft/Qx10sroYzePyuEQ/UgcHZZDsEiF53TcYudJfeIxchfpn SNAKzsumTSYnFpoQuLHJnsCUpQdeUCNFjlv8vsSpHRnpWjjlZzXdioe/3Lqi0US+38 yfnd4Y63ZNbxA== 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