From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout05.his.huawei.com (canpmsgout05.his.huawei.com [113.46.200.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A1F534388E for ; Tue, 9 Jun 2026 07:21:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.220 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780989686; cv=none; b=roATC1op6Ntk7scpsWpNPGtZ+ck98wBoM/LdUpblVksjvgn0bNtaCN6sEivbkyAt20nW6jwanzq5+juZjBYju9B/sslK8POsVqh8McdbICfZ9DY7wG3lR7K5PvZSuJYR2HKIJt2OBWIfWSsXqY/ufc08kdixkyLotrpqQ0wYqaw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780989686; c=relaxed/simple; bh=vqg9gvXA9iQYtCUlPX+568MM5RYXAhPS1DAQBL/BUME=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=d7BDOaikCaJJCPsbu03IZqOzZhIazQVlDeQAg6dT+ML3aAJmLxGs1uxeWU3M/EidpwMOar6H+UR82Sfzut8OC/ncGfXH1eCiSt7al5f22pDZmgmOkbdBs93HJNqX4DNxFww5CYPPBPaCIbavQIBdF6SLrizQSPwkk/MqBEKszBw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=mhb3fKWO; arc=none smtp.client-ip=113.46.200.220 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="mhb3fKWO" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=8+Be/msfBZtJukRPzLQLXA2fKfRd2kL8+CeLPELdzpE=; b=mhb3fKWO/56GBarof3VIzwDq4Ng27oqkB3jO36ZmpJe19CzqDmNrUTVjxaw0EUxSU+AfyI/6K SkalN3jk6NvMbMsSYGJTE2jc+jTD1oykmTVPbDyfqxUMTNaUI+CLZSw6IONzRGImI8YgYNqxWX5 bkP/2K1c/ynwf4MQI8hZc4w= Received: from mail.maildlp.com (unknown [172.19.162.197]) by canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4gZKrK5clbz12LHT; Tue, 9 Jun 2026 15:13:21 +0800 (CST) Received: from dggemv706-chm.china.huawei.com (unknown [10.3.19.33]) by mail.maildlp.com (Postfix) with ESMTPS id 1E4BE40569; Tue, 9 Jun 2026 15:21:14 +0800 (CST) Received: from kwepemq500010.china.huawei.com (7.202.194.235) by dggemv706-chm.china.huawei.com (10.3.19.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 9 Jun 2026 15:21:13 +0800 Received: from [10.173.124.160] (10.173.124.160) by kwepemq500010.china.huawei.com (7.202.194.235) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 9 Jun 2026 15:21:12 +0800 Subject: Re: [PATCH v5 3/4] mm/memory-failure: skip take_page_off_buddy after dissolving HWPoison HugeTLB page To: Jiaqi Yan CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , References: <20260531055829.3636554-1-jiaqiyan@google.com> <20260531055829.3636554-4-jiaqiyan@google.com> From: Miaohe Lin Message-ID: Date: Tue, 9 Jun 2026 15:21:11 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20260531055829.3636554-4-jiaqiyan@google.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemq500010.china.huawei.com (7.202.194.235) On 2026/5/31 13:58, Jiaqi Yan wrote: > Now that HWPoison subpage(s) within HugeTLB page will be rejected by > buddy allocator during dissolve_free_hugetlb_folio(), there is no > need to drain_all_pages() and take_page_off_buddy() anymore. In fact, > calling take_page_off_buddy() after dissolve_free_hugetlb_folio() > succeeded returns false, making caller think __page_handle_poison() > failed. > > Add __hugepage_handle_poison() and replace __page_handle_poison() at > HugeTLB specific call sites. The being handled HugeTLB page either > is free at the moment of try_memory_failure_hugetlb(), or becomes > free at the moment of me_huge_page(). > > Signed-off-by: Jiaqi Yan > --- > mm/memory-failure.c | 36 ++++++++++++++++++++++++++++++------ > 1 file changed, 30 insertions(+), 6 deletions(-) > > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index 95979b7995c1..098c4407e818 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -163,6 +163,30 @@ static struct rb_root_cached pfn_space_itree = RB_ROOT_CACHED; > static DEFINE_MUTEX(pfn_space_lock); > > /* > + * Only for a HugeTLB page being handled by memory_failure(). The key > + * difference to soft_offline() is that, no HWPoison subpage will make > + * into buddy allocator after a successful dissolve_free_hugetlb_folio(), > + * so take_page_off_buddy() is unnecessary. > + */ > +static int __hugepage_handle_poison(struct page *page) > +{ > + struct folio *folio = page_folio(page); > + > + VM_WARN_ON_FOLIO(!folio_test_hwpoison(folio), folio); > + > + /* > + * Can't use dissolve_free_hugetlb_folio() without a reliable > + * raw_hwp_list telling which subpage is HWPoison. This reminds me that hugetlb_raw_hwp_unreliable folios can be freed into buddy yet? Should we handle them too? > + */ > + if (folio_test_hugetlb_raw_hwp_unreliable(folio)) > + /* raw_hwp_list becomes unreliable when kmalloc() fails. */ > + return -ENOMEM; If folios have hugetlb_raw_hwp_unreliable set, hugetlb_update_hwpoison will return MF_HUGETLB_FOLIO_PRE_POISONED thus these folios cannot reach here, e.g. me_huge_page. The only way these folios can reach here is that they are hwpoisoned first time so hugetlb_update_hwpoison returns 0 even if hugetlb_raw_hwp_unreliable is set at the same time. In that case, we can simply dissolve the hugetlb folios and then take the sole hwpoisoned @page off buddy? But this might not be a good idea as it is really fragile... Thanks. .