From patchwork Thu Mar 21 14:24:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13598777 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 011AEC54E68 for ; Thu, 21 Mar 2024 14:25:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 251776B0096; Thu, 21 Mar 2024 10:25:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1661F6B0098; Thu, 21 Mar 2024 10:25:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EAE946B0099; Thu, 21 Mar 2024 10:25:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D2CBB6B0096 for ; Thu, 21 Mar 2024 10:25:11 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id AB1D1A15AD for ; Thu, 21 Mar 2024 14:25:11 +0000 (UTC) X-FDA: 81921268422.29.127A754 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf07.hostedemail.com (Postfix) with ESMTP id C9C2F40023 for ; Thu, 21 Mar 2024 14:25:09 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="rB/KMdaV"; dmarc=none; 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711031109; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pVgu8F+HUxFYXHQ8q7hUsgbZUWBjtZzUu+JH6Hd85qY=; b=lM3T/2U1/glNGabzFaW79w2UaPaSREz5FzGA5e4I96Vg2HiE4qhGjhyz6eC7qIXWIW2pwp ivlGHsyE9jAGFSERG+HfR/TjP9SSDAsNTo51mhZpQjz0NmxnxsylY/7YryaxGxFqVb5USc KT0yJrtD/0ID7KU4ePfx49LyJyEds50= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="rB/KMdaV"; dmarc=none; 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711031109; a=rsa-sha256; cv=none; b=4Vzp2rOUP4xrxO+yJmut63DUoJVItziq7rS+/rIHSAfvxksAfmqPcTSo3qGMjBlgygNNGI ludSlYBs6jxnAw/mUxLw2j5F0AVybAvbPKfPiy6Kr1BRxPmEE58nrxWuWW2ndDBsom0MJn 3G7KCPMb9/+ixcAzxxQtxA7U8RzR3hc= 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=pVgu8F+HUxFYXHQ8q7hUsgbZUWBjtZzUu+JH6Hd85qY=; b=rB/KMdaVGxjLcMzjJL7/JMK9u+ nNkmy/TutiWXmphtt9Ro/xQrlv1yEeYIyl0IB3ljZprvmo+i+Cj5ksiFALBXKQ+601sqsHwomNWic SMTXrXdPoSTfJHDCZSzYQzLQqa6RzFzQ62t1+Edjih9GC4p0/7gX3281eAefY0bc5DoXj6kWSCKM2 1A8/JrMeb/7HDV+wPZFW+t3yXZnCS1Wvk3BTOM2YHcVzOnowJC7zHHS7hlXNbDvc2DBsGY57WBvXI 88vS0zxStbdKzEFRlMo37uaTtIgsEQLtnBk567x/m8cve0KPz6cXEClhEtTcet1RdNfuYczucF1Oe 2y4k3+BQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnJLf-00000006u44-39lp; Thu, 21 Mar 2024 14:24:51 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, David Hildenbrand , Vlastimil Babka , Miaohe Lin , Muchun Song , Oscar Salvador Subject: [PATCH 6/9] mm: Remove a call to compound_head() from is_page_hwpoison() Date: Thu, 21 Mar 2024 14:24:44 +0000 Message-ID: <20240321142448.1645400-7-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240321142448.1645400-1-willy@infradead.org> References: <20240321142448.1645400-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: C9C2F40023 X-Stat-Signature: fzah93irxjidwj7soeup3etjhr848w6u X-Rspam-User: X-HE-Tag: 1711031109-516111 X-HE-Meta: U2FsdGVkX18knQRTV2D1a+AC6G3fedRw5Q9iIkjKS/G5Y3iRsJy/0rNidsIqhiC0QkbQqtx5sNS8daeQrJdMzW8B0t1lpBlZtjs4NTsnuzyig2Smw0FvbSrbDWgKIPP3yyUbO9jZiTaxPESQmfYu8NKJ++cHSaHN5NriYiIz9UdwmEhOYbc0Y0INo/nzZ41YNw2wNhmAUl5MAij/1D/g38ps/Q+NSWgTyjIVkSc3EMuRFo1Bn8y+l0QzdSiQdYvH1SUT9ikWGpCqc9FSr1AVKS5qzzszfAdsNlG3VlLXn2mwfuvJhVDhjwTdS3vTraAeCTxLanfgD+HeD0PMIpC9pOxZr2JkLHS41QhNJiSGGfQGjsiRdkWhn5oBFsV7SxMyTxrxjed3Gq+mOTbU4GzzjmKFh8vyQMw/jU2NNaVvV5hY4OJqmZ6mlOtg69KhE3I0a/aT6iQWLB8PCvUdcotv0wsmgGsLrbp6l6VTi2f4582dQr/FdmmoPzhuCFeAyA0ZJuuYsogpTgCyLKyduRGr2cBUAAf75hynzq6OnQQA4+9m7snpPQeYDDgWhGOkdYVcZIFdjtBupwCtK98qEEifHOOTYqw65DVIjrNbzDbXTXZq5LGvbwC8YxFSayMRHofbtzdOFpfwqqxBjh/v2dWwY0PLvgc59pVWaoqXMpSxb4jnMqqiKCxjfWziuODjXs2apNzySBg1FzrIxEw9NgIbpsx0kUXOrdzYux9EwaZijnjGyK5T2y7DsD+ZPrb9IdVhFcYrXzXpAQQ7DA14cvlJ0hHZ5ROQpMxiNILATUaUNBpjzXeUuIbxKtFp9ptci+KWAT80k8ERTY7U+BH/V5K6/SUBI+I7gnXL22+3kg5bTWLILfLeKCzTUmhMu7GAsPOIXId4yhVZD/PIN6GKZsbAXwOAFel8VFF4fsdAgeqjqqfDhPeXcVUJYQCt9DAz5Y6s1p7LTXVjTbYZ4eidtOB ARiApsmb MnvRfCVbY//oj+wqtBsH/xvyrvcrWmRF770p8/mwgGC4GTC3ccddA73QFcb9C/QTsvXAlGwd3KzQTo1NJoH8Spw0vlOF1+njyo29qrGod6wFRgV9Bva278AghDBLhh+dUBtaJtoo4r2PUh2muij8EqNT97dKO9M7aOnMunj0imLSqHjk750U6YgUAe4O/PkU9CAp4G9kPBDJI/+1puSgeoH3ygCCfsPZEB+yWVnMlmj1IILAlwhdhQCli+Al5rWjAgcEGqjl/OhXFwenqzzYpNFv76w== 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: List-Subscribe: List-Unsubscribe: We can call it only once instead of twice. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand Reviewed-by: Miaohe Lin Acked-by: Vlastimil Babka --- include/linux/page-flags.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 6fb3cd42ee59..94eb8a11a321 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -1065,11 +1065,14 @@ static inline bool PageHuge(const struct page *page) * best effort only and inherently racy: there is no way to synchronize with * failing hardware. */ -static inline bool is_page_hwpoison(struct page *page) +static inline bool is_page_hwpoison(const struct page *page) { + const struct folio *folio; + if (PageHWPoison(page)) return true; - return PageHuge(page) && PageHWPoison(compound_head(page)); + folio = page_folio(page); + return folio_test_hugetlb(folio) && PageHWPoison(&folio->page); } extern bool is_free_buddy_page(struct page *page);