From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f65.google.com (mail-ej1-f65.google.com [209.85.218.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E48E9426693 for ; Wed, 4 Feb 2026 15:24:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.65 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770218654; cv=none; b=Zye4msGBprETDlqVTO2kjjH5jl0Qt8xVHTa1oK7OykRJnwzi4hDGqyVC64nm9g/lsd9tif39JDa1q+y1c9/TX+t7Pxo+ZzJzY62c7FnBtq92FX4nwQhw9GgEFWRyDWuqh+152S/SKQ8k8GtIdKE0ZVWjUizgsSljzhO3CKcVB18= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770218654; c=relaxed/simple; bh=TA693lspFABceA6Nm/3yRKhGqPGsSqQZ8ffBRDBhYYo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iI2G/TWqEa2x17/GVeK1G6VcvkaiT9QuY3XAnk71Wo0ZPTpK+1KHEukArnSVjtmof6pMgbANOi4ZI4GgdO3RowWeMcthX7oW2bV3XnXJuy0YGCxUlyQB8Eq+7DowbwoEVGfQX8BXdhGfL9YLCcnpamHrBOnZfjCK3OPtPLhSa+Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=delta-utec.com; spf=none smtp.mailfrom=delta-utec.com; dkim=pass (2048-bit key) header.d=delta-utec-com.20230601.gappssmtp.com header.i=@delta-utec-com.20230601.gappssmtp.com header.b=XuhRjn+A; arc=none smtp.client-ip=209.85.218.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=delta-utec.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=delta-utec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=delta-utec-com.20230601.gappssmtp.com header.i=@delta-utec-com.20230601.gappssmtp.com header.b="XuhRjn+A" Received: by mail-ej1-f65.google.com with SMTP id a640c23a62f3a-b884d5c787bso1214880866b.0 for ; Wed, 04 Feb 2026 07:24:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=delta-utec-com.20230601.gappssmtp.com; s=20230601; t=1770218652; x=1770823452; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HOCklTVJSoz/0GlLyW4AmbDRNJcWn4GEKUozxS6wdv0=; b=XuhRjn+AgUvf0jqzoC8QP06gw9SqOzftroDTXvkWJckCpm3gORI5pwWIz+FQiU3R1f OTjJE24sJ9OVl3eyb3fF6WidSOTATRuZ70UYqiA3m9h6kwyZdruBT2Y3Dbx/LwvTCOZN 7yK+1WSc98bgGOJPvEpc2EEBItBKu6Eu7db01+exZS8XxJo01QZO/OPjzJdVFoEwLje3 inqU/oLDTZSxvb+njFzSNdfHMCMh3QxfvWNtfN7O99hlw6C3NOgitLsih/I6N6NSpxRu ZxL/dSF/pcY208qeRzMOD/pkzKQyJky7zT+K2MW7LdfRLRnPCTYK53dsGNiG1E/B1o5/ 3NHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770218652; x=1770823452; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=HOCklTVJSoz/0GlLyW4AmbDRNJcWn4GEKUozxS6wdv0=; b=bBQ753nezpTdjM+gA57nphyGSnJpnaDhEhYAIvQ7pdojiZjBvn+OAZ+bGKFaUPUnoR vEI9deFxeHtYIFZygq0s+MB4o0rkeVLcRRn0jjq8vzCfZeX+E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by 2002:a17:907:746:b0:b8e:4470:6caf with SMTP id a640c23a62f3a-b8e9f0d470dmr235513166b.22.1770218652002; Wed, 04 Feb 2026 07:24:12 -0800 (PST) Received: from bou-desktop.arnhem.chello.nl (2001-1c00-3406-8400-85ea-1e81-1e0a-8a4d.cable.dynamic.v6.ziggo.nl. [2001:1c00:3406:8400:85ea:1e81:1e0a:8a4d]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8ea0044a09sm130627866b.56.2026.02.04.07.24.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Feb 2026 07:24:11 -0800 (PST) From: Boudewijn van der Heide To: jiaqiyan@google.com Cc: Liam.Howlett@oracle.com, akpm@linux-foundation.org, boudewijn@delta-utec.com, david@redhat.com, duenwen@google.com, hannes@cmpxchg.org, harry.yoo@oracle.com, jackmanb@google.com, jane.chu@oracle.com, jthoughton@google.com, linmiaohe@huawei.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, lorenzo.stoakes@oracle.com, mhocko@suse.com, muchun.song@linux.dev, nao.horiguchi@gmail.com, osalvador@suse.de, rientjes@google.com, rppt@kernel.org, surenb@google.com, tony.luck@intel.com, vbabka@suse.cz, wangkefeng.wang@huawei.com, william.roche@oracle.com, willy@infradead.org, ziy@nvidia.com Subject: Re: [PATCH v4 0/3] Only free healthy pages in high-order has_hwpoisoned folio Date: Wed, 4 Feb 2026 16:23:52 +0100 Message-ID: <20260204152352.55606-1-boudewijn@delta-utec.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260202194125.2191216-1-jiaqiyan@google.com> References: <20260202194125.2191216-1-jiaqiyan@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Jiaqi, Thanks for including the THP scenario. > Another similar situation is when a transparent huge page (THP) > is handled by MFR but splitting failed. Such THP will eventually > be released to buddy allocator when owning userspace processes > are gone, but with certain subpages having HWPoison [9]. I think for failed-split THP, we need to do the following to support them: diff --git a/mm/memory-failure.c b/mm/memory-failure.c index cf0d526e6d41..3f727038f400 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2479,6 +2479,7 @@ int memory_failure(unsigned long pfn, int flags) if (err || new_order) { /* get folio again in case the original one is split */ folio = page_folio(p); + folio_set_has_hwpoisoned(folio); res = -EHWPOISON; kill_procs_now(p, pfn, flags, folio); put_page(p); We set the PG_has_hwpoison flag here again, because when the split partially succeeds (new_order > 0), page_folio(p) returns a new smaller-order folio that doesn't have the flag set. Without this, when the THP is eventually freed, free_pages_prepare() won't see the flag and HWPoison subpages could enter the buddy allocator. This aligns with what Miaohe mentioned in the earlier discussion [1]: IMHO, it's enough to handle poisoned sub-pages when in-use or split-failed THP eventually be released to the buddy. Would you prefer to add this to your series, or should I send a separate follow-up patch? [1] https://lore.kernel.org/linux-mm/20260113205441.506897-1-boudewijn@delta-utec.com/ Kind regards, Boudewijn