Message ID | 20230526075552.363524-2-mcgrof@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp296891vqr; Fri, 26 May 2023 00:58:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6EUCbybVZ/wRDwpLi3Rv4KK/ZECC7KoozId+SkjT12Gsl2x7W1j83YC9XJrju33jGZh2wX X-Received: by 2002:a05:6a20:2585:b0:10e:e1f9:d197 with SMTP id k5-20020a056a20258500b0010ee1f9d197mr1342938pzd.38.1685087930397; Fri, 26 May 2023 00:58:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685087930; cv=none; d=google.com; s=arc-20160816; b=QpzgOpICyPdGxzU/j8sFqfJ/ainADwHY1Wl2taPRPb11iaaFS8ZmXmsteE/TZnFOTm b14HOg9NydJQKxXLzGxpulnCKMEJwPnzS3YBQ1Lw8KAxX8sm5NaxNSV4jkOBQQZtJPYN nAd0xcC18MrQIGZO4MnQA2V74RDULPmnNFLTVc0waGtgBUvanetuzktjMLEzBfASGLfC d9AGXP9U6lBtcpEecKpLrSCd2jLrfjkgGeminarP4hjv8WDN2Uj6GoV/5j98WalIb4Vf ZdLuIxQvAeKdu7hIniygF+IIZD22XvehY+KJpwyCsQtaCqHczEsrQk585OGM9vSCt1P/ Ny5A== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y25-20020a63b519000000b00535401db8d9si3059326pge.674.2023.05.26.00.58.36; Fri, 26 May 2023 00:58:50 -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 S242631AbjEZH4S (ORCPT <rfc822;zhanglyra.2023@gmail.com> + 99 others); Fri, 26 May 2023 03:56:18 -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 <rfc822;linux-kernel@vger.kernel.org>); 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 <mcgrof@kernel.org> 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 <mcgrof@infradead.org> 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766942762134761750?= X-GMAIL-MSGID: =?utf-8?q?1766942762134761750?= |
Series |
add support for blocksize > PAGE_SIZE
|
|
Commit Message
Luis Chamberlain
May 26, 2023, 7:55 a.m. UTC
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 <mcgrof@kernel.org>
---
include/linux/page-flags.h | 7 +++++++
1 file changed, 7 insertions(+)
Comments
On Fri, May 26, 2023 at 12:55:45AM -0700, Luis Chamberlain wrote: > 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. But it's not "is poison". it's "contains poison". So how about folio_contains_hwpoison() as a name? But what do you really want to know here? In the Glorious Future, individual pages get their memdesc pointer set to be a hwpoison pointer. Are we going to need to retain a bit in every memdesc to say whether one of the pages in the memdesc has been poisoned? Or can we get away with just testing individual pages as we look at them?
On Fri, May 26, 2023 at 02:51:34PM +0100, Matthew Wilcox wrote: > On Fri, May 26, 2023 at 12:55:45AM -0700, Luis Chamberlain wrote: > > 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. > > But it's not "is poison". it's "contains poison". So how about > folio_contains_hwpoison() as a name? Would a smaller change in tense to "is poisoned" also work? I think that's mostly synonymous to "contains poison".
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