[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220204195852.1751729-7-willy@infradead.org>
Date: Fri, 4 Feb 2022 19:57:43 +0000
From: "Matthew Wilcox (Oracle)" <willy@...radead.org>
To: linux-mm@...ck.org
Cc: "Matthew Wilcox (Oracle)" <willy@...radead.org>,
linux-kernel@...r.kernel.org, Christoph Hellwig <hch@....de>,
John Hubbard <jhubbard@...dia.com>,
Jason Gunthorpe <jgg@...dia.com>,
William Kucharski <william.kucharski@...cle.com>
Subject: [PATCH 06/75] mm/gup: Change the calling convention for compound_next()
Return the head page instead of storing it to a passed parameter.
Reorder the arguments to match the calling function's arguments.
Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
Reviewed-by: Christoph Hellwig <hch@....de>
Reviewed-by: John Hubbard <jhubbard@...dia.com>
Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
Reviewed-by: William Kucharski <william.kucharski@...cle.com>
---
mm/gup.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/mm/gup.c b/mm/gup.c
index 75a0a1fd4c2a..7e4bdae83e9b 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -270,9 +270,8 @@ static inline struct page *compound_range_next(struct page *start,
return page;
}
-static inline void compound_next(unsigned long i, unsigned long npages,
- struct page **list, struct page **head,
- unsigned int *ntails)
+static inline struct page *compound_next(struct page **list,
+ unsigned long npages, unsigned long i, unsigned int *ntails)
{
struct page *page;
unsigned int nr;
@@ -283,8 +282,8 @@ static inline void compound_next(unsigned long i, unsigned long npages,
break;
}
- *head = page;
*ntails = nr - i;
+ return page;
}
/**
@@ -322,7 +321,7 @@ void unpin_user_pages_dirty_lock(struct page **pages, unsigned long npages,
}
for (index = 0; index < npages; index += ntails) {
- compound_next(index, npages, pages, &head, &ntails);
+ head = compound_next(pages, npages, index, &ntails);
/*
* Checking PageDirty at this point may race with
* clear_page_dirty_for_io(), but that's OK. Two key
@@ -411,7 +410,7 @@ void unpin_user_pages(struct page **pages, unsigned long npages)
return;
for (index = 0; index < npages; index += ntails) {
- compound_next(index, npages, pages, &head, &ntails);
+ head = compound_next(pages, npages, index, &ntails);
put_compound_head(head, ntails, FOLL_PIN);
}
}
--
2.34.1
Powered by blists - more mailing lists