From patchwork Fri Feb 4 19:57:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12735555 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 47DA6C433F5 for ; Fri, 4 Feb 2022 20:00:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F1876B00A1; Fri, 4 Feb 2022 14:59:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C1FC8D0010; Fri, 4 Feb 2022 14:59:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9CB018D001A; Fri, 4 Feb 2022 14:59:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0122.hostedemail.com [216.40.44.122]) by kanga.kvack.org (Postfix) with ESMTP id 36ABD8D000D for ; Fri, 4 Feb 2022 14:59:13 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E2A4F18239AB7 for ; Fri, 4 Feb 2022 19:59:12 +0000 (UTC) X-FDA: 79106161344.14.8713994 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf12.hostedemail.com (Postfix) with ESMTP id 7D3E140003 for ; Fri, 4 Feb 2022 19:59:12 +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=5ceAUAT4Vee+0EAbCvwnmoDPrxJaboihVhPCOhlPlTw=; b=dJrhAaMhXwdxCqG26FeGweR8mm L0SDMW76URQW9r23SaCMTH4uqr6bbrlu+EtT+yQWvwua7WnHV09au1fBqDpdaf2HOJi3I3RCdYmwW tZrSc70x45edae/jMdUrN4537YtY4PhS8CqwvKgdJ0iBipEnSN31zcMLIXp8CHqdXJmYIqtzQUPmW l5J2uGR4uHUScjMHgVmaDN7Xc5Urt6/iAJaCtun7zkbiQ2ULMcx+z7M7W0DC1sOmqbGyJsAin0cLu bOvrGeHOzhB7osBdTfd7ksGfgmQynhdkb/6XiHmLp/qvgnKUEZEsOA8OzT9MdHJa/2rqxY0bgG+RC G3JVsbRg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nG4jU-007LlD-2y; Fri, 04 Feb 2022 19:59:00 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org, Christoph Hellwig , John Hubbard , Jason Gunthorpe , William Kucharski Subject: [PATCH 06/75] mm/gup: Change the calling convention for compound_next() Date: Fri, 4 Feb 2022 19:57:43 +0000 Message-Id: <20220204195852.1751729-7-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220204195852.1751729-1-willy@infradead.org> References: <20220204195852.1751729-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 7D3E140003 X-Rspam-User: nil Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=dJrhAaMh; dmarc=none; spf=none (imf12.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Stat-Signature: qc4phqr7baiknaq6u6d3rx3siizs4up4 X-Rspamd-Server: rspam08 X-HE-Tag: 1644004752-560613 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. Reorder the arguments to match the calling function's arguments. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Reviewed-by: John Hubbard Reviewed-by: Jason Gunthorpe Reviewed-by: William Kucharski --- 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); } }