From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f50.google.com (mail-dl1-f50.google.com [74.125.82.50]) (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 79FA5353A70 for ; Sat, 10 Oct 2026 16:21:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791649304; cv=none; b=PTrHk2Bhvc0IrtBCc/WOoh6Q2XB6OXAXM28eWVdSSGW9jATe2IQ2gmXLCR8Ul165fP5K8hh828cjVw0x3wXswEXKaL92prY5FVvnZWP/Ssjx92qyYf5xhETAuAA6euUE5z+iru32Q9gD8SEmQGPuIlv+x2tu0D2Wlkfw0lqZVZA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791649304; c=relaxed/simple; bh=y4C4vQTdn2bxnFX2RYOiAcm5lbpDJJqJCWsVTjoUgQo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bwbMYI7rVgH9sWSaCEgR7a2F9+SiZNbNc64VVoYBIr5EKEm8/faWlJrQETaFQuENCPCrNLNxClrls3j7ITvQYo/UFzzZjd7ZB0Lp+1FR1M9x6vu3L+qW7v7BFy1aKC/Yqxw+Orbes5/CnMegEc4yjuptF0JFtJe1A90gTWaPYS4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=U93DCDd6; arc=none smtp.client-ip=74.125.82.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U93DCDd6" Received: by mail-dl1-f50.google.com with SMTP id a92af1059eb24-141395927feso1175640c88.0 for ; Sat, 10 Oct 2026 09:21:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791649303; x=1792254103; 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:content-type; bh=y8PWS9Qoyo16uTAXAyqsyaf8MZtKTZdCptpC3zTJnlA=; b=U93DCDd6gWTRgRM7M4qpukAa/Se8UN7e5Ts7rlpldcxZAe2qLVzZlG/WiC00gKxxNE rPwZyVd+1Vv5GwGr3aIHm0cBxs1lfJYP+P0a6rX8K6kzRvboymptDpCEFssrrdSyK4Fo 9OGPqKBI1CO9N7HPh4jPcCxyl+JaMhgvdsYrkA+l8stw88nfEdwi4KL4C1wReOPgsI9z noQtaphHYA/orc/LtzwnpHiPIG3e1Pjg3Vj4JMbZSicZfNxrqLuPHxb+huz78i0lYS0p OzE8wiKSQ+u/fp3JtyvZvt/JHWMn6BqYOaZv4vZ2BNMTcHGVVNphbWG33ItCf/rQSN10 ntoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791649303; x=1792254103; 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:content-type; bh=y8PWS9Qoyo16uTAXAyqsyaf8MZtKTZdCptpC3zTJnlA=; b=mBJjSpObOSnItx48cEJClhIwk00FuMTn7iHYFE1dJagVCAgbdG+3W4p6NQwweXE8kd cDARcqFpj90TVKmY3JPU9qKJ1uY9zKAAHHDYIKAFS6eQFHTIVfuDvu8e+NnylPHJZM6O tPWtjkLLiCTqtxqrDScNxEVshwomMVwuAYwa5coQsH7qEYcweZ2NVxjrmJ8VeADyvkx0 J38+2zKy0waReL4jPJRYB8C62JppT2k+anDAa8N1mrZO0IQqv7Fb8oqICg1x187278oP N6/EbT8m6jgfWi2as19Ye/AjhwK+wKx/BctS32dXCDQj+pzpUYwttRHLgmvhqmh3f00L tZmg== X-Forwarded-Encrypted: i=1; AKwUvBxegfiU8P1CYxoJrXzY7MCYPJQsGhCJVyKEgK1OrYJTSeTULM50+USSAAIUZ5r4NifXzvdqg7aTyp4tscU=@vger.kernel.org X-Gm-Message-State: AFq9FYKqkPRgWlrGB3uR9cWRBua/wzWZVGEK6JukXshk4FwB84fwkV+m NXHB0BmbNoSM4U6JKnYIj7ulusEij0S/Xgw5liXPdBek+Rx6XY7xbe8R X-Gm-Gg: AYBFou0irkgng5xpEZDuIXBtZ99PjJeVHPoiVu8+x807oZWrDPqhCrTvENtGU+cD+Rg n7bV6Hi5hTrJUHGoUHiR2yIsUiHfEzUbR4mwB5+biq+yc+Xsl1R0hSr0xNvhE93mDDgWF8KEX52 t/xHU/umpu3fe9tGrTu1PBUCknWlcecIiSSgqzhp2I0VmYvIRtVzvpcoo+UiqUwDa6bMfJIR3kc cpgLGhlre7mr3wUXkvSOrwncNLxZy6mXdCWFW/tflHApd9q16injf/pK55vFE+Jxulp2041o7Yl zYjkEpC1F6rMYCNoeYC/9Rc2ByMYDA/0PaZRKDz3jm5fVspKVe1zytZaJlorqxzILg4al+ZRhUH ChJ5CVXHUnHQpdBtexBGfk3FAYVr0pTA5w3pUkNqbunfesrHE13s0/EUfpTjqTBUv2mJa2l0Nfj TwI28YqRPgZGsiwxhImEO06Lgeaa86QqYBeyHe0c8uhyQCQMM+LPqgaI+pPtAoCyCdcrkxnu4/u +8hnMBEIaZ7P4LRKg== X-Received: by 2002:a05:701b:291c:b0:141:4951:f150 with SMTP id a92af1059eb24-16a5ea5d6famr6277251c88.18.1791649302496; Sat, 10 Oct 2026 09:21:42 -0700 (PDT) Received: from acer-nitro-anv15-41.. ([115.96.176.39]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-169a3f6186fsm15778622c88.14.2026.10.10.09.21.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Oct 2026 09:21:42 -0700 (PDT) From: Shaikh Kamaluddin To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Dan Williams , Miaohe Lin , Andrew Morton , Vlastimil Babka , Breno Leitao Cc: Ira Weiny , Li Ming , Richard Cheng , Naoya Horiguchi , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, David Hildenbrand , Oscar Salvador , Kiryl Shutsemau , Harry Yoo , Shaikh Kamaluddin Subject: [RFC PATCH 4/5] mm/page_alloc: Keep pre-online poison out of the buddy allocator Date: Sat, 10 Oct 2026 21:50:12 +0530 Message-ID: <20261010162017.62506-5-shaikhkamal2012@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261010162017.62506-1-shaikhkamal2012@gmail.com> References: <20261010162017.62506-1-shaikhkamal2012@gmail.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 The inherited-poison path checks initialized blocks before releasing them to the buddy allocator. CXL device poison discovered before hot-added memory is onlined is recorded separately in the pre-online poison registry. Extend __free_pages_core() to send a block to free_poisoned_block() when it intersects either poison source. In free_poisoned_block(), withhold a page when its PFN is registered as pre-online poison or its physical address is present in the inherited-poison table. Pages identified by either source continue through hwpoison_boot_page(), while clean pages are released through accept_and_free_block(). Signed-off-by: Shaikh Kamaluddin --- mm/page_alloc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index cca67a2702a4..57843df01b2a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -1601,12 +1602,14 @@ static void __meminit free_poisoned_block(struct page *page, unsigned int order, enum meminit_context context) { unsigned long i, nr_pages = 1UL << order; + unsigned long pfn = page_to_pfn(page); for (i = 0; i < nr_pages; i++) { struct page *p = page + i; phys_addr_t phys = page_to_phys(p); - if (range_contains_poisoned_memory(phys, PAGE_SIZE)) { + if (range_contains_poisoned_memory(phys, PAGE_SIZE) || + preonline_hwpoison_contains(pfn + i)) { hwpoison_boot_page(p, context); continue; } @@ -1652,7 +1655,8 @@ void __meminit __free_pages_core(struct page *page, unsigned int order, /* First: a block parked by __free_unaccepted() never returns here. */ if (range_contains_poisoned_memory(page_to_phys(page), - PAGE_SIZE << order)) { + PAGE_SIZE << order) || + preonline_hwpoison_intersects(page_to_pfn(page), nr_pages)) { free_poisoned_block(page, order, context); return; } -- 2.43.0