Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp134364ybv; Thu, 6 Feb 2020 19:39:06 -0800 (PST) X-Google-Smtp-Source: APXvYqzmeWhB6VA905SUuJjfbWAt2nG2rnjJHzdWgiQwbO9E+Oxazso1p32nQle1pPJe4/BtHMbx X-Received: by 2002:a9d:7c9a:: with SMTP id q26mr1168898otn.206.1581046746520; Thu, 06 Feb 2020 19:39:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581046746; cv=none; d=google.com; s=arc-20160816; b=w5yxpu65PiyHWWN6LVgec0m6pJvz5ssjKkHBLiPVtn5DllzOkNe6niMDuXP50eKz7E Ymr5nF8pkMpEgspP6YdtWaXyUHTdSabCLOGFpDCRxAgnqj7CuxmiqKk+vTaSTzdMsctP Vl5X7ZqH6p6NBIGRiznpqWCTcHA6bgQc5lIY6TYy+DAcokTTzGXP2h6B8X4qX8Z0eqk1 TW9JGfLOmELl/Hp/biRqvJk3E38/ELolY/UbIbfiVmYjJ9pl1C87r0CprpbFmqKY5zAi ZaB1xiPrJh1A/gR5zfl9c1hmvNzhMFPWQUR/QBDmhHI1o7jS2lYUie1RiW852vY9Uye1 JzKw== 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=V8K6RnRI+4PrGMgTn0z64DZqxWe0b5fcs/s/r3LtdzYMsUuzwdlNhXxD/0GInf1KsQ K5JwvNaxIqUdmA9bemFUW4/8kYWO/S3E4udIGqhcn4tOYXKBle59lMTTYIrNtYFuPDjI sP0JcxKfQl4ZUKLlxAtqyKwZlD9hWTYFkL9fopxD/jotyo+M9V947wFQ9UYEk6w8C/Os paWPCa6Imr8C7eGm8UVrDOTM/xmRqRWTQXx2TFJneo49d5TZFetLDCP2QLBRJM00rmTR rS1yT7Wu19jjb3At/ZyZ475ZjfHmV2vWw/hrKos2S5QL7kS0VObYXO0oDGcEEuDeNzX8 F/lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=BZ7IOW08; 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 h18si966147otk.227.2020.02.06.19.38.54; Thu, 06 Feb 2020 19:39:06 -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=BZ7IOW08; 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 S1727690AbgBGDhr (ORCPT + 99 others); Thu, 6 Feb 2020 22:37:47 -0500 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:13366 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727587AbgBGDhm (ORCPT ); Thu, 6 Feb 2020 22:37:42 -0500 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 06 Feb 2020 19:37:12 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Thu, 06 Feb 2020 19:37:37 -0800 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Thu, 06 Feb 2020 19:37:37 -0800 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 7 Feb 2020 03:37:36 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 7 Feb 2020 03:37:36 +0000 Received: from blueforge.nvidia.com (Not Verified[10.110.48.28]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Thu, 06 Feb 2020 19:37:36 -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 v5 03/12] mm/gup: pass a flags arg to __gup_device_* functions Date: Thu, 6 Feb 2020 19:37:26 -0800 Message-ID: <20200207033735.308000-4-jhubbard@nvidia.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200207033735.308000-1-jhubbard@nvidia.com> References: <20200207033735.308000-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=1581046632; 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=BZ7IOW08VMig3ZvuZbdHCqlBvHE0hCtsmfDYe2g93wWP+bbQFFpCRQ+vUaDzoDKKB pgoPhdWlYsNWQU9PDRa2sfRqJKAdqP/BNoj9a44gEmGvgKVBPUDHCE4cnBUvGjXX1/ RgJ3BonJAU7r7tin+WU36Wql+OWIaQkLcooSuVeJYqwffC/SQfKrdYmErOy3ZXInvM WhzLelaWiNMjTOsJaAKSW7NpL8Jks+o8qhA+8MpS+SmW6PINvR6s2/ULrOsfb44zZ0 LD1G4w/MDUkOTnJlN3krNs9gFo7oHw9r5I9Xj7Co7UIYQWyXcjtdQIou6HiCnpkmo6 E85LH6wPJzAxQ== 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