Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2070296rwd; Fri, 26 May 2023 00:58:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ569mBQHBqt5QI6dXZ7ytajEOnELJchlH0l5OyyE/dxuOs04Hdrc/dZPQqu9xoOW50JkTob X-Received: by 2002:a17:903:32ca:b0:1ae:35b8:d59b with SMTP id i10-20020a17090332ca00b001ae35b8d59bmr1761054plr.41.1685087923221; Fri, 26 May 2023 00:58:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685087923; cv=none; d=google.com; s=arc-20160816; b=DdqjtxRjcnbOSIPFvFAwPVmnXuXSTUPe0mTYQ6ABqMUpnho6KIAqvEVpjAZOv1SHD6 4m6JLKd0GohhROOZVTBDxtKep0qPWuz65IJMkeX9k1X19QnUPlJNhz6pom2SieKynH3r wsTkkS97dfHZj60KnzPaxxZBQcwnhWKuwkfpk/LAyhafxkMg7GqDXlbeo5J1ulWW5Qs1 hIxjP0Bx+s1xpWV7Re4IyeQzVP8ysC1x2UYqlnEyQTr2wekk/qbxYA/fpO8lEfts6bsQ hO7EjY5VjeuCWDURdwAodFg0BR7zFqsqwoOYDiZHYxNv9F35pf9aC39sziwch+UxjzqU TTew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5oQ2gGbUsqL42uQDz21dyQWBbUA0px4CnOLURAD/lus=; b=aZTFQyZ8a/Uqf8IkYD8huSvU4lapA7n5joyQNjKT5oP6GM+ExxOOBRi1aptxjwyRnH MXMo1ov18dgBHHjInzSlbDc2rd2EZ/KFfOzOtOre6C88EcUCVXyszUvHCV2qTuQZIO2X VCIQ6kkHkPTw4grcA80fVXVyFLdl0Ks+XDHED4EpfbtyqBeeNWZhRAx1HTHxl9h2x+rX tuyL4bdvgg77nBJNnHeH5kN+m6Q0KT56oegYSpohhF9p6GWH8ATGHMPhEKH4H8RdnnOX lEKFEKKJnC/rxM0s153DTmy7/c3eP+d6YHWdQ611rG5gO7YrNT0LKAQscTzxMpsYCnDx rrWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=LdiDWYPf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id li12-20020a170903294c00b001aaf1734d1dsi3209417plb.241.2023.05.26.00.58.28; Fri, 26 May 2023 00:58:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=LdiDWYPf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242630AbjEZH4R (ORCPT + 99 others); Fri, 26 May 2023 03:56:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242581AbjEZH4I (ORCPT ); Fri, 26 May 2023 03:56:08 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A06819D; Fri, 26 May 2023 00:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=5oQ2gGbUsqL42uQDz21dyQWBbUA0px4CnOLURAD/lus=; b=LdiDWYPfbsR2VwE3muTukBHf1n 2WKuZw7xVn16RN6k6Wo9ylU0o5DsPwzzrnruYbzYdoYyEpJt744EXDXhFgaq3aPLQM0XtiDj2f8FP 2plHBSw0sndtNX7DTHqerD4102mCieETYl1G0dRVa+cHO3vzNpp7xWDo8hVulJyMeNAOkZv4L98nW 6TmrmiHMZRz3tMGsyF1olHjbXr53o35bSOXIQ23JnCL7T/TEVq47iBber3uY3gk1HYKtkAuea4Vam CYKjwRSPO0HEhImDxfLN6W/tI67qgSTWbDSI9uMVp9MT7NiJOiaImnK7AjLb+fCQHpyGYE6dCefwT r8p56qVA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1q2SIj-001WZg-2T; Fri, 26 May 2023 07:55:53 +0000 From: Luis Chamberlain To: hughd@google.com, akpm@linux-foundation.org, willy@infradead.org, brauner@kernel.org, djwong@kernel.org Cc: p.raghav@samsung.com, da.gomez@samsung.com, rohan.puri@samsung.com, rpuri.linux@gmail.com, a.manzanares@samsung.com, dave@stgolabs.net, yosryahmed@google.com, keescook@chromium.org, hare@suse.de, kbusch@kernel.org, mcgrof@kernel.org, patches@lists.linux.dev, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC v2 1/8] page_flags: add is_folio_hwpoison() Date: Fri, 26 May 2023 00:55:45 -0700 Message-Id: <20230526075552.363524-2-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230526075552.363524-1-mcgrof@kernel.org> References: <20230526075552.363524-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Provide a helper similar to is_page_hwpoison() for folios which tests the first head and if the folio is large any page in the folio is tested for the poison flag. Signed-off-by: Luis Chamberlain --- include/linux/page-flags.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 1c68d67b832f..4d5f395edf03 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -883,6 +883,13 @@ static inline bool is_page_hwpoison(struct page *page) return PageHuge(page) && PageHWPoison(compound_head(page)); } +static inline bool is_folio_hwpoison(struct folio *folio) +{ + if (folio_test_hwpoison(folio)) + return true; + return folio_test_large(folio) && folio_test_has_hwpoisoned(folio); +} + /* * For pages that are never mapped to userspace (and aren't PageSlab), * page_type may be used. Because it is initialised to -1, we invert the -- 2.39.2