From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Jiaqi Yan <jiaqiyan@google.com>,
Muhammad Usama Anjum <usama.anjum@collabora.com>,
linmiaohe@huawei.com, mike.kravetz@oracle.com,
naoya.horiguchi@nec.com, akpm@linux-foundation.org,
songmuchun@bytedance.com, shy828301@gmail.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
jthoughton@google.com,
"kernel@collabora.com" <kernel@collabora.com>
Subject: Re: [PATCH v4 4/4] selftests/mm: add tests for HWPOISON hugetlbfs read
Date: Thu, 11 Jan 2024 10:11:12 -0800 [thread overview]
Message-ID: <39b90dce-fe0f-e1d8-3094-75cabbfa38a3@oracle.com> (raw)
In-Reply-To: <ZaAtjVVTETdQDR4B@casper.infradead.org>
On 1/11/24 10:03 AM, Matthew Wilcox wrote:
> On Thu, Jan 11, 2024 at 09:51:47AM -0800, Sidhartha Kumar wrote:
>> On 1/11/24 9:34 AM, Jiaqi Yan wrote:
>>>> - if (!folio_test_has_hwpoisoned(folio))
>>>> + if (!folio_test_hwpoison(folio))
>>>
>>> Sidhartha, just curious why this change is needed? Does
>>> PageHasHWPoisoned change after commit
>>> "a08c7193e4f18dc8508f2d07d0de2c5b94cb39a3"?
>>
>> No its not an issue PageHasHWPoisoned(), the original code is testing for
>> the wrong flag and I realized that has_hwpoison and hwpoison are two
>> different flags. The memory-failure code calls folio_test_set_hwpoison() to
>> set the hwpoison flag and does not set the has_hwpoison flag. When
>> debugging, I realized this if statement was never true despite the code
>> hitting folio_test_set_hwpoison(). Now we are testing the correct flag.
>>
>> From page-flags.h
>>
>> #ifdef CONFIG_MEMORY_FAILURE
>> PG_hwpoison, /* hardware poisoned page. Don't touch */
>> #endif
>>
>> folio_test_hwpoison() checks this flag ^^^
>>
>> /* At least one page in this folio has the hwpoison flag set */
>> PG_has_hwpoisoned = PG_error,
>>
>> while folio_test_has_hwpoisoned() checks this flag ^^^
>
> So what you're saying is that hugetlb behaves differently from THP
> with how memory-failure sets the flags?
I think so, in memory_failure() THP goes through this path:
hpage = compound_head(p);
if (PageTransHuge(hpage)) {
/*
* The flag must be set after the refcount is bumped
* otherwise it may race with THP split.
* And the flag can't be set in get_hwpoison_page() since
* it is called by soft offline too and it is just called
* for !MF_COUNT_INCREASED. So here seems to be the best
* place.
*
* Don't need care about the above error handling paths for
* get_hwpoison_page() since they handle either free page
* or unhandlable page. The refcount is bumped iff the
* page is a valid handlable page.
*/
SetPageHasHWPoisoned(hpage);
which sets has_hwpoisoned flag while hugetlb goes through
folio_set_hugetlb_hwpoison() which calls folio_test_set_hwpoison().
next prev parent reply other threads:[~2024-01-11 18:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-13 0:18 [PATCH v4 0/4] Improve hugetlbfs read on HWPOISON hugepages Jiaqi Yan
2023-07-13 0:18 ` [PATCH v4 1/4] mm/hwpoison: delete all entries before traversal in __folio_free_raw_hwp Jiaqi Yan
2023-07-13 0:18 ` [PATCH v4 2/4] mm/hwpoison: check if a raw page in a hugetlb folio is raw HWPOISON Jiaqi Yan
2023-07-13 0:18 ` [PATCH v4 3/4] hugetlbfs: improve read HWPOISON hugepage Jiaqi Yan
2023-07-13 0:18 ` [PATCH v4 4/4] selftests/mm: add tests for HWPOISON hugetlbfs read Jiaqi Yan
2024-01-05 6:27 ` Muhammad Usama Anjum
2024-01-05 21:13 ` Jiaqi Yan
2024-01-10 6:49 ` Muhammad Usama Anjum
2024-01-10 10:15 ` Muhammad Usama Anjum
2024-01-11 2:32 ` Sidhartha Kumar
2024-01-11 8:48 ` Muhammad Usama Anjum
2024-01-11 17:34 ` Jiaqi Yan
2024-01-11 17:51 ` Sidhartha Kumar
2024-01-11 18:03 ` Matthew Wilcox
2024-01-11 18:11 ` Sidhartha Kumar [this message]
2024-01-11 18:30 ` Jiaqi Yan
2024-01-11 18:36 ` Sidhartha Kumar
2024-01-12 6:16 ` Muhammad Usama Anjum
2024-01-19 10:10 ` Linux regression tracking #update (Thorsten Leemhuis)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=39b90dce-fe0f-e1d8-3094-75cabbfa38a3@oracle.com \
--to=sidhartha.kumar@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=jiaqiyan@google.com \
--cc=jthoughton@google.com \
--cc=kernel@collabora.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=naoya.horiguchi@nec.com \
--cc=shy828301@gmail.com \
--cc=songmuchun@bytedance.com \
--cc=usama.anjum@collabora.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox