From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) (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 D98DC3F58E6 for ; Tue, 7 Jul 2026 11:08:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783422504; cv=none; b=tktP89n3uf0L4VlLwMvgiwXvyNPptSjWvmNUrhOtZMidE46R5VOfD2z5r8Te39b7HRXCmL6NEDxv3lyfc1QRdgB3DBRF0W4mlk99lLws5C3Y4o2r/Hfk6/rDe91cBTLnyMS/KlR7VgsjMoTJQlFhLFzCDEQ3L1qC2OoIfL1nVgI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783422504; c=relaxed/simple; bh=ylRP5/eO+LrA32oz2uzmsoq89LVoFyOI6VQwpHdGnVE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=KOvfjS6DD0r3deX1vMOSdXwfpArGfJI9/ZwfDYav2viVs8ZxLA6sqhL6Hhlty+pRtEj46Cfz0+vTPwxiKFEdNYicjTmQcOLGhZYNMulOu0Tc3kGoxywEQadgutMbxQtwOo8wk4g0tP0hj5nMx9WeBEY0xltnWFbagOJjTIbRFjM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=vvDpW0xf; arc=none smtp.client-ip=115.124.30.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="vvDpW0xf" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1783422489; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; bh=ao7EL9LJmqoFPIpPMnfYLwye1FreZjwPxf1v+Z1e6zw=; b=vvDpW0xf39THN1iby3AmkOxCHrCjvo0mNSoF7bAPlZRcJZ8AiZ6ETV4RBEuXw/GzussjJCDGLxY6jhDOtm/NgJtXq9BYejhFXsnSWZzEz765QESqw4vdFTOcctGDJjNLRo8EVxI8ZQPexWmVveSQulwoTwT9slnSUY17xnYDqj8= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R651e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045098064;MF=ying.huang@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0X6dH8g._1783422486; Received: from DESKTOP-5N7EMDA(mailfrom:ying.huang@linux.alibaba.com fp:SMTPD_---0X6dH8g._1783422486 cluster:ay36) by smtp.aliyun-inc.com; Tue, 07 Jul 2026 19:08:07 +0800 From: "Huang, Ying" To: "David Hildenbrand (Arm)" , Kaitao Cheng Cc: Andrew Morton , Zi Yan , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Alistair Popple , Naoya Horiguchi , Andi Kleen , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Kaitao Cheng Subject: Re: [PATCH v2] mm/migrate: Avoid copying hwpoisoned folios during migration In-Reply-To: (David Hildenbrand's message of "Tue, 7 Jul 2026 12:08:26 +0200") References: <20260707090136.52904-1-kaitao.cheng@linux.dev> Date: Tue, 07 Jul 2026 19:08:06 +0800 Message-ID: <87o6gjnjl5.fsf@DESKTOP-5N7EMDA> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ascii "David Hildenbrand (Arm)" writes: > On 7/7/26 11:01, Kaitao Cheng wrote: >> From: Kaitao Cheng >> >> The generic folio migration path can copy the source folio after it has >> been unmapped. For normal and THP folios this goes through >> move_to_new_folio(), then the filesystem or anonymous migration callback, >> and commonly reaches folio_mc_copy(). >> >> folio_mc_copy() uses copy_mc_highpage(), but architectures without >> copy_mc_to_kernel support fall back to copy_highpage(). If the source >> folio already contains a hwpoisoned page, a normal copy can consume the >> poisoned memory and trigger a synchronous machine check. > > Well, but the code can still race with memory_failure() IIUC, so it's not really > safe either? Yes. So the better way to fix this is to implement copy_mc_to_kernel() for the target architectures, or to implement the trick in the fallback? --- Best Regards, Huang, Ying