mm/gup: pass a flags arg to __gup_device_* functions

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.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jérôme Glisse <jglisse@redhat.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Link: http://lkml.kernel.org/r/20200211001536.1027652-3-jhubbard@nvidia.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
John Hubbard 2020-04-01 21:05:14 -07:00 committed by Linus Torvalds
parent 22bf29b67d
commit 86dfbed49f

View File

@ -1963,7 +1963,8 @@ static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end,
#if defined(CONFIG_ARCH_HAS_PTE_DEVMAP) && defined(CONFIG_TRANSPARENT_HUGEPAGE) #if defined(CONFIG_ARCH_HAS_PTE_DEVMAP) && defined(CONFIG_TRANSPARENT_HUGEPAGE)
static int __gup_device_huge(unsigned long pfn, unsigned long addr, 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 = *nr; int nr_start = *nr;
struct dev_pagemap *pgmap = NULL; struct dev_pagemap *pgmap = NULL;
@ -1989,13 +1990,14 @@ static int __gup_device_huge(unsigned long pfn, unsigned long addr,
} }
static int __gup_device_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr, static int __gup_device_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr,
unsigned long end, struct page **pages, int *nr) unsigned long end, unsigned int flags,
struct page **pages, int *nr)
{ {
unsigned long fault_pfn; unsigned long fault_pfn;
int nr_start = *nr; int nr_start = *nr;
fault_pfn = pmd_pfn(orig) + ((addr & ~PMD_MASK) >> PAGE_SHIFT); fault_pfn = 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; return 0;
if (unlikely(pmd_val(orig) != pmd_val(*pmdp))) { if (unlikely(pmd_val(orig) != pmd_val(*pmdp))) {
@ -2006,13 +2008,14 @@ static int __gup_device_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr,
} }
static int __gup_device_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr, static int __gup_device_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr,
unsigned long end, struct page **pages, int *nr) unsigned long end, unsigned int flags,
struct page **pages, int *nr)
{ {
unsigned long fault_pfn; unsigned long fault_pfn;
int nr_start = *nr; int nr_start = *nr;
fault_pfn = pud_pfn(orig) + ((addr & ~PUD_MASK) >> PAGE_SHIFT); fault_pfn = 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; return 0;
if (unlikely(pud_val(orig) != pud_val(*pudp))) { if (unlikely(pud_val(orig) != pud_val(*pudp))) {
@ -2023,14 +2026,16 @@ static int __gup_device_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr,
} }
#else #else
static int __gup_device_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr, static int __gup_device_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr,
unsigned long end, struct page **pages, int *nr) unsigned long end, unsigned int flags,
struct page **pages, int *nr)
{ {
BUILD_BUG(); BUILD_BUG();
return 0; return 0;
} }
static int __gup_device_huge_pud(pud_t pud, pud_t *pudp, unsigned long addr, static int __gup_device_huge_pud(pud_t pud, pud_t *pudp, unsigned long addr,
unsigned long end, struct page **pages, int *nr) unsigned long end, unsigned int flags,
struct page **pages, int *nr)
{ {
BUILD_BUG(); BUILD_BUG();
return 0; return 0;
@ -2146,7 +2151,8 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr,
if (pmd_devmap(orig)) { if (pmd_devmap(orig)) {
if (unlikely(flags & FOLL_LONGTERM)) if (unlikely(flags & FOLL_LONGTERM))
return 0; 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);
} }
page = pmd_page(orig) + ((addr & ~PMD_MASK) >> PAGE_SHIFT); page = pmd_page(orig) + ((addr & ~PMD_MASK) >> PAGE_SHIFT);
@ -2167,7 +2173,8 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr,
} }
static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr, 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; struct page *head, *page;
int refs; int refs;
@ -2178,7 +2185,8 @@ static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr,
if (pud_devmap(orig)) { if (pud_devmap(orig)) {
if (unlikely(flags & FOLL_LONGTERM)) if (unlikely(flags & FOLL_LONGTERM))
return 0; 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);
} }
page = pud_page(orig) + ((addr & ~PUD_MASK) >> PAGE_SHIFT); page = pud_page(orig) + ((addr & ~PUD_MASK) >> PAGE_SHIFT);