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 76AAFC433FE for ; Fri, 4 Feb 2022 20:21:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 90D938D0002; Fri, 4 Feb 2022 15:21:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7F4596B007D; Fri, 4 Feb 2022 15:21:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D3448D0002; Fri, 4 Feb 2022 15:21:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0186.hostedemail.com [216.40.44.186]) by kanga.kvack.org (Postfix) with ESMTP id 4D15C6B007B for ; Fri, 4 Feb 2022 15:21:34 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0C09D18274D01 for ; Fri, 4 Feb 2022 20:21:34 +0000 (UTC) X-FDA: 79106217708.29.A6D0A14 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf03.hostedemail.com (Postfix) with ESMTP id 7D28F20005 for ; Fri, 4 Feb 2022 20:21:33 +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=33UEnkkNiFlfpyXfZQc/LWytQLTqEtcMw8GjP7m9GVg=; b=Wgw2CjNZqh9Erx8pW4gMctzcJf UZqLpn5pTUpas0OFMO2M5k5zis+SCoZIqOjYZthR6WSiz1fE/BONQXvgBQZOFNWoHgFKiYoYerw0d qQP6VKW7n5A6fv3OPPdAZCyUIfG/56Yis5fso2i1DYM8qfhgLBLy1bcJXc0uMHlFsQfSxjhbpT2Ae uEV0V5fIK1aSLAE9nDxhqQZbZW8+wsIuNtPJWl98mDeaSBPkGj+DfjEzswgwvQi8A2343UmsSyFyU Liwh0IhA9veh31c4tGKIXEyRcPvCLA1G970OUx+hy8K56XI8f+92iPiU8v0pRaEj2FfudcUIBQbpX 5uy1vmpg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nG4jT-007Ll5-QC; Fri, 04 Feb 2022 19:58:59 +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 02/75] mm/gup: Remove for_each_compound_range() Date: Fri, 4 Feb 2022 19:57:39 +0000 Message-Id: <20220204195852.1751729-3-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-Rspam-User: nil X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 7D28F20005 X-Stat-Signature: d6bkqooccr587imd1pzqarn1uwcc378b Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Wgw2CjNZ; dmarc=none; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1644006093-26663 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: This macro doesn't simplify the users; it's easier to just call compound_range_next() inside the loop. 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 | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 08020987dfc0..dc00e46fae5a 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -261,9 +261,6 @@ static inline void compound_range_next(unsigned long = i, unsigned long npages, struct page *next, *page; unsigned int nr =3D 1; =20 - if (i >=3D npages) - return; - next =3D *list + i; page =3D compound_head(next); if (PageCompound(page) && compound_order(page) >=3D 1) @@ -274,12 +271,6 @@ static inline void compound_range_next(unsigned long= i, unsigned long npages, *ntails =3D nr; } =20 -#define for_each_compound_range(__i, __list, __npages, __head, __ntails)= \ - for (__i =3D 0, \ - compound_range_next(__i, __npages, __list, &(__head), &(__ntails))= ; \ - __i < __npages; __i +=3D __ntails, \ - compound_range_next(__i, __npages, __list, &(__head), &(__ntails))= ) - static inline void compound_next(unsigned long i, unsigned long npages, struct page **list, struct page **head, unsigned int *ntails) @@ -396,7 +387,8 @@ void unpin_user_page_range_dirty_lock(struct page *pa= ge, unsigned long npages, struct page *head; unsigned int ntails; =20 - for_each_compound_range(index, &page, npages, head, ntails) { + for (index =3D 0; index < npages; index +=3D ntails) { + compound_range_next(index, npages, &page, &head, &ntails); if (make_dirty && !PageDirty(head)) set_page_dirty_lock(head); put_compound_head(head, ntails, FOLL_PIN); --=20 2.34.1