[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZEMRbcHSQqyek8Ov@casper.infradead.org>
Date: Fri, 21 Apr 2023 23:42:53 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: hughd@...gle.com, akpm@...ux-foundation.org, brauner@...nel.org,
djwong@...nel.org, p.raghav@...sung.com, da.gomez@...sung.com,
a.manzanares@...sung.com, dave@...olabs.net, yosryahmed@...gle.com,
keescook@...omium.org, hare@...e.de, kbusch@...nel.org,
patches@...ts.linux.dev, linux-block@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC 2/8] shmem: convert to use folio_test_hwpoison()
On Fri, Apr 21, 2023 at 02:43:54PM -0700, Luis Chamberlain wrote:
> The PageHWPoison() call can be converted over to the respective folio call
> folio_test_hwpoison(). This introduces no functional changes.
Um, no. Nobody should use folio_test_hwpoison(), it's a nonsense.
Individual pages are hwpoisoned. You're only testing the head page
if you use folio_test_hwpoison(). There's folio_has_hwpoisoned() to
test if _any_ page in the folio is poisoned. But blindly converting
PageHWPoison to folio_test_hwpoison() is wrong.
If anyone knows how to poison folio_test_hwpoison() to make it not
work, I'd appreciate it.
> Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
> ---
> mm/shmem.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 5bf92d571092..6f117c3cbe89 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -3483,7 +3483,7 @@ static const char *shmem_get_link(struct dentry *dentry,
> folio = filemap_get_folio(inode->i_mapping, 0);
> if (IS_ERR(folio))
> return ERR_PTR(-ECHILD);
> - if (PageHWPoison(folio_page(folio, 0)) ||
> + if (folio_test_hwpoison(folio) ||
> !folio_test_uptodate(folio)) {
> folio_put(folio);
> return ERR_PTR(-ECHILD);
> @@ -3494,7 +3494,7 @@ static const char *shmem_get_link(struct dentry *dentry,
> return ERR_PTR(error);
> if (!folio)
> return ERR_PTR(-ECHILD);
> - if (PageHWPoison(folio_page(folio, 0))) {
> + if (folio_test_hwpoison(folio)) {
> folio_unlock(folio);
> folio_put(folio);
> return ERR_PTR(-ECHILD);
> @@ -4672,7 +4672,7 @@ struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
> return &folio->page;
>
> page = folio_file_page(folio, index);
> - if (PageHWPoison(page)) {
> + if (folio_test_hwpoison(folio)) {
> folio_put(folio);
> return ERR_PTR(-EIO);
> }
> --
> 2.39.2
>
Powered by blists - more mailing lists