From mboxrd@z Thu Jan 1 00:00:00 1970 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 0A3D0C433F5 for ; Mon, 10 Jan 2022 04:24:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 105F36B0087; Sun, 9 Jan 2022 23:24:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E94616B0088; Sun, 9 Jan 2022 23:24:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C23256B0089; Sun, 9 Jan 2022 23:24:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0001.hostedemail.com [216.40.44.1]) by kanga.kvack.org (Postfix) with ESMTP id A5D826B0087 for ; Sun, 9 Jan 2022 23:24:26 -0500 (EST) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 72A5196F0E for ; Mon, 10 Jan 2022 04:24:26 +0000 (UTC) X-FDA: 79013085732.31.BB80C68 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf20.hostedemail.com (Postfix) with ESMTP id 083B51C0002 for ; Mon, 10 Jan 2022 04:24:25 +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=Z6FL4QqZXpHUsas/XSj8HAlMM6U3EcqhJKpaCEuMmN8=; b=gxWZW6abe4i+kvz3u9LtWrvatH BoiG6HjaV3GJHxMRnfZSa7H9MJrW92RwHaeh3xjnfLoiR0eUxaQ7XdWjA/BL6eJb0/QcWDZvVS8Rt DCaSPmPce+iympJJ2YASM5qmcfx5BuQSc65ohl4fkLmb+tdj5xAwUXehLGGdLSl619nzH1L/FHKl+ UDpwP47wln4ui7FvBWkA7D+nkmrPQjhcA/QvbT0pxWGDMVnveDBAJfolGSS/6tgIsLbRqfcL/616V gIejTrUhUfqYl3v3R+N0T6w0T8MRjR91OhMBPs1fbjvyix4twfVWIX6h6Z46/JLPO1L/n2goXg0KT xg9aX3Qw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6mE8-0025wa-8a; 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 05/28] gup: Change the calling convention for compound_next() Date: Mon, 10 Jan 2022 04:23:43 +0000 Message-Id: <20220110042406.499429-6-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 Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=gxWZW6ab; spf=none (imf20.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-Queue-Id: 083B51C0002 X-Stat-Signature: 9u8ruenmhn6xqmubdtnhnye4k7uk1ke7 X-Rspamd-Server: rspam04 X-HE-Tag: 1641788665-771203 Content-Transfer-Encoding: quoted-printable 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. Signed-off-by: Matthew Wilcox (Oracle) --- mm/gup.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 6eedca605b3d..8a0ea220ced1 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -245,9 +245,8 @@ static inline struct page *compound_range_next(unsign= ed long i, return page; } =20 -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(unsigned long i, + unsigned long npages, struct page **list, unsigned int *ntails) { struct page *page; unsigned int nr; @@ -258,8 +257,8 @@ static inline void compound_next(unsigned long i, uns= igned long npages, break; } =20 - *head =3D page; *ntails =3D nr - i; + return page; } =20 /** @@ -297,7 +296,7 @@ void unpin_user_pages_dirty_lock(struct page **pages,= unsigned long npages, } =20 for (index =3D 0; index < npages; index +=3D ntails) { - compound_next(index, npages, pages, &head, &ntails); + head =3D compound_next(index, npages, pages, &ntails); /* * Checking PageDirty at this point may race with * clear_page_dirty_for_io(), but that's OK. Two key @@ -386,7 +385,7 @@ void unpin_user_pages(struct page **pages, unsigned l= ong npages) return; =20 for (index =3D 0; index < npages; index +=3D ntails) { - compound_next(index, npages, pages, &head, &ntails); + head =3D compound_next(index, npages, pages, &ntails); put_compound_head(head, ntails, FOLL_PIN); } } --=20 2.33.0