Re: [PATCH v1 2/6] mm/hwpoison: remove race consideration

From: Ding Hui
Date: Tue Jun 15 2021 - 08:57:16 EST


On 2021/6/14 10:12, Naoya Horiguchi wrote:
@@ -1956,17 +1938,6 @@ int unpoison_memory(unsigned long pfn)
goto unlock_mutex;
}
- /*
- * unpoison_memory() can encounter thp only when the thp is being
- * worked by memory_failure() and the page lock is not held yet.
- * In such case, we yield to memory_failure() and make unpoison fail.
- */
- if (!PageHuge(page) && PageTransHuge(page)) {
- unpoison_pr_info("Unpoison: Memory failure is now running on %#lx\n",
- pfn, &unpoison_rs);
- goto unlock_mutex;
- }
-

if a huge page is in process of alloc or free, HUGETLB_PAGE_DTOR can be set after __SetPageHead() or be cleared before __ClearPageHead(), so this condition may be true in racy.

Do we need the racy test for this situation?

if (!get_hwpoison_page(p, flags)) {
if (TestClearPageHWPoison(p))
num_poisoned_pages_dec();
--
Thanks,
- Ding Hui