From patchwork Mon Jan 10 04:23:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12708190 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8BBFC433F5 for ; Mon, 10 Jan 2022 04:25:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C70576B00AD; Sun, 9 Jan 2022 23:24:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BD4296B00AE; Sun, 9 Jan 2022 23:24:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 483576B00B1; Sun, 9 Jan 2022 23:24:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0227.hostedemail.com [216.40.44.227]) by kanga.kvack.org (Postfix) with ESMTP id EFC3D6B00B0 for ; Sun, 9 Jan 2022 23:24:47 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B1017181C1958 for ; Mon, 10 Jan 2022 04:24:47 +0000 (UTC) X-FDA: 79013086614.03.55ACD21 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf23.hostedemail.com (Postfix) with ESMTP id 5CBC514000C for ; Mon, 10 Jan 2022 04:24:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=gT8RG9vD2iSbfvGg96Co6y7w74G3UgjYv7qBo/++MyI=; b=L2bhR2Cjml5DgbFsb0VbH/LASg hlrKrN5EDZSd+ik3iO94aKLBEhpESoh/ldGOKrbgbPmXGIu2qcbXCiAV8shqq+2/ODx3xlHB3+uR1 WXT2IWUHvpb3nAyxNS6UB8iQuPoLnEXLBQjD+gbex6c8IeDmYwqqlmyXJYD5WTjcNo12L6LLjE4i6 5IM8D1DQiY1HLOCzEqDN7ohzauoczPQSlIU0qIRibEvBiy4Aoezi+R2uI2P9jUtjmtREtxignvDIQ cPKhkILOzRhHzQBEAIQvme1db678BNuBgNhF3s0NoYWQDURb8fcVaWWKuI8yOQSqfYGyJIuDXyPx1 dFjKdG2A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6mE8-0025wW-3h; Mon, 10 Jan 2022 04:24:12 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , John Hubbard , Christoph Hellwig , William Kucharski , linux-kernel@vger.kernel.org, Jason Gunthorpe Subject: [PATCH v2 03/28] gup: Change the calling convention for compound_range_next() Date: Mon, 10 Jan 2022 04:23:41 +0000 Message-Id: <20220110042406.499429-4-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220110042406.499429-1-willy@infradead.org> References: <20220110042406.499429-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 5CBC514000C X-Stat-Signature: qtyti3sug4sgibbfet4rf1kg8trw1d1j Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=L2bhR2Cj; spf=none (imf23.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam10 X-HE-Tag: 1641788687-369564 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Return the head page instead of storing it to a passed parameter. Pass the start page directly instead of passing a pointer to it. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: John Hubbard --- mm/gup.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 86f8d843de72..3c93d2fdf4da 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -229,21 +229,20 @@ void unpin_user_page(struct page *page) } EXPORT_SYMBOL(unpin_user_page); -static inline void compound_range_next(unsigned long i, unsigned long npages, - struct page **list, struct page **head, - unsigned int *ntails) +static inline struct page *compound_range_next(unsigned long i, + unsigned long npages, struct page *start, unsigned int *ntails) { struct page *next, *page; unsigned int nr = 1; - next = *list + i; + next = start + i; page = compound_head(next); if (PageCompound(page) && compound_order(page) >= 1) nr = min_t(unsigned int, page + compound_nr(page) - next, npages - i); - *head = page; *ntails = nr; + return page; } static inline void compound_next(unsigned long i, unsigned long npages, @@ -355,7 +354,7 @@ void unpin_user_page_range_dirty_lock(struct page *page, unsigned long npages, unsigned int ntails; for (index = 0; index < npages; index += ntails) { - compound_range_next(index, npages, &page, &head, &ntails); + head = compound_range_next(index, npages, page, &ntails); if (make_dirty && !PageDirty(head)) set_page_dirty_lock(head); put_compound_head(head, ntails, FOLL_PIN);