From patchwork Mon Jan 10 04:23:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12708182 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 888F4C433F5 for ; Mon, 10 Jan 2022 04:24:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 76BD76B0096; Sun, 9 Jan 2022 23:24:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6CB906B0098; Sun, 9 Jan 2022 23:24:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 51D0F6B0099; Sun, 9 Jan 2022 23:24:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0124.hostedemail.com [216.40.44.124]) by kanga.kvack.org (Postfix) with ESMTP id 3607F6B0096 for ; Sun, 9 Jan 2022 23:24:33 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id EE5E0181C1958 for ; Mon, 10 Jan 2022 04:24:32 +0000 (UTC) X-FDA: 79013085984.08.D27C4D7 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf10.hostedemail.com (Postfix) with ESMTP id 87D2FC0005 for ; Mon, 10 Jan 2022 04:24:32 +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=rKKpy0oluulkvLBfnA/9hhQL753tZQacHkRyC1WeJU0=; b=sGdCDh4ZVcVD4kmjTA+PY/SRmA Xy0yRyA5WDiywX9swJnbRDtdRVp/t9tnbO0FbJIbD8klaRw1FSmjZ6aQ3s87Zqfm83GSNw9+W6EBB jUEqlKQg87FdYHfliSejnX27WaWwrifLIdLGxqtuIivNfw8F47wH/NJVLGNkh9RiWTPp/jc+Mjpr/ 4OzgBeACGD0VX+bJqHy4Oh3gbqvvXQK2HdoX5rjTR92I/QwNL951f1izvcp4+2VZw0t66GoH8Pp2c dzDjq+odwp2UsO4gda+0abuQYve0KMcJcKKClan7zrqcmr/MWnR0NbwZfC0BJO5Z0xGFZMxeKcQML SErKzKMg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6mE7-0025wS-Uo; Mon, 10 Jan 2022 04:24:11 +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 01/28] gup: Remove for_each_compound_range() Date: Mon, 10 Jan 2022 04:23:39 +0000 Message-Id: <20220110042406.499429-2-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-Server: rspam03 X-Rspamd-Queue-Id: 87D2FC0005 X-Stat-Signature: wefcfuczzmntmn5fn3na3mn79ra8dqm5 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=sGdCDh4Z; dmarc=none; spf=none (imf10.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: 1641788672-653081 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 --- mm/gup.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 2c51e9748a6a..7a07e0c00bf5 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -236,9 +236,6 @@ static inline void compound_range_next(unsigned long i, unsigned long npages, struct page *next, *page; unsigned int nr = 1; - if (i >= npages) - return; - next = *list + i; page = compound_head(next); if (PageCompound(page) && compound_order(page) >= 1) @@ -249,12 +246,6 @@ static inline void compound_range_next(unsigned long i, unsigned long npages, *ntails = nr; } -#define for_each_compound_range(__i, __list, __npages, __head, __ntails) \ - for (__i = 0, \ - compound_range_next(__i, __npages, __list, &(__head), &(__ntails)); \ - __i < __npages; __i += __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) @@ -371,7 +362,8 @@ void unpin_user_page_range_dirty_lock(struct page *page, unsigned long npages, struct page *head; unsigned int ntails; - for_each_compound_range(index, &page, npages, head, ntails) { + for (index = 0; index < npages; index += 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);