From patchwork Mon Jan 10 04:23:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12708179 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 1125AC433EF for ; Mon, 10 Jan 2022 04:24:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DADAB6B008A; Sun, 9 Jan 2022 23:24:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D0D0F6B008C; Sun, 9 Jan 2022 23:24:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B5F616B0092; Sun, 9 Jan 2022 23:24:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0041.hostedemail.com [216.40.44.41]) by kanga.kvack.org (Postfix) with ESMTP id 9DE146B008A for ; Sun, 9 Jan 2022 23:24:29 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4B07A181AEF09 for ; Mon, 10 Jan 2022 04:24:29 +0000 (UTC) X-FDA: 79013085858.12.A84C41D Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf07.hostedemail.com (Postfix) with ESMTP id 13C2540008 for ; Mon, 10 Jan 2022 04:24:28 +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=zipY2Xef+bdp0dO6EMAI54lIjbt9nG2TQ8Ia2LQ9a/Q=; b=ns5OGy9Zz2OyKInKaLEalu2rr6 qg8S/j7UAKJxQzhpBFlCFvfgDQm/xaI4heaNVADhMk5hbH25uKPWE70CgIHr+u8FtdkeRgHDzldrm btpoe3/2uFb7+edVFD6tJjWaEj/OMkHQ22Xu/Bu/de0utTgIEQjHOvtK6+1wR6JmAwZww3Of1yb5v /MGjs6Jk2ANLvphPBpkFDvrreMxs5n11Hd9CsxU7X+KEfc9SL4iyLC8X53kQFaY785bAEQM6ng0Lu CpzNuR/qQh1XJpRTKtfDtTncReANru/+fgpdvIXzZc2dpTNsEN9TOtbOdOv5WHQLXxHehsufxIYfU BkVJoCOg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6mE8-0025wY-68; 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 04/28] gup: Optimise compound_range_next() Date: Mon, 10 Jan 2022 04:23:42 +0000 Message-Id: <20220110042406.499429-5-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: 13C2540008 X-Stat-Signature: qpo5ngn89h8tfp4u4w5u8pt8753ac8k7 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ns5OGy9Z; spf=none (imf07.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: 1641788668-455392 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: By definition, a compound page has an order >= 1, so the second half of the test was redundant. Also, this cannot be a tail page since it's the result of calling compound_head(), so use PageHead() instead of PageCompound(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Reviewed-by: John Hubbard --- mm/gup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/gup.c b/mm/gup.c index 3c93d2fdf4da..6eedca605b3d 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -237,7 +237,7 @@ static inline struct page *compound_range_next(unsigned long i, next = start + i; page = compound_head(next); - if (PageCompound(page) && compound_order(page) >= 1) + if (PageHead(page)) nr = min_t(unsigned int, page + compound_nr(page) - next, npages - i);