From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (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 1BC9B30C62C for ; Tue, 17 Feb 2026 09:33:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771320825; cv=none; b=UQOU4nPJRQWutnttNeyOW4DTlTHVDgL+GoRggzRWHN2cxGD2DgfgUW90DtgEYpU5YRStbg+ddK+Zo/DwlftW+d5Mq/9OQ1rQpCo6mkCMsu3FdzUX06ekeB4mOJNaUquWIMXosGDN4XwtD7E1De6vbuNJGFfQFDE0xaZsJG1Lviw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771320825; c=relaxed/simple; bh=B07OPuUveTlk+b/va2juR1LXkVUa801jcSG6qIxxN2Q=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=N0qkVUKtSPM9CMRlegZBh3VeU6mn83bbT+mFhyqxRW7wqblbGAXYeEAmA+29z1NS7mkcxNmxtBFcpEDLh1ISKQOh8cjFls5OQFaWLkkAwhWFoxPRzO81mU7vCDw5vxwHoAMHNANu3KiZMIuSlD6aVt4s4nTCkoHtUhH9dxwy0tw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ZZKRyNIC; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZZKRyNIC" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-4830e7c6131so41256845e9.2 for ; Tue, 17 Feb 2026 01:33:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1771320822; x=1771925622; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=x8U/V9GGZCQ16QVrv/ncm3L2JAXBCx3yPL1lZ3d8azI=; b=ZZKRyNICf4fq8KoRhHKo7iCi/OhI35Vp3+ZZSFBovS+0n+6pJ7Pv8ZueLIxETWZQoZ Xylv+if45N6doveO7Ou2AIodAgFVxRze1JjTh7Id1Rqjg8bAB+DBkvHl+E32JEZEdaQ8 oUw2p3/qmZvizifSpwWePBigIvTVhuVH+XNayJBloi+cTZXgu9v/2przlodpAGsVq1iK jETInLLvrZHbbwDWmgP8cJb3UXaOAVuBwJtACqQPjevOzgI/+o5peb85rXxrkYeOp/Tn I3Y4F2rNLsUTJARIK99OBTcITUTl4bRnXACkJJfhjnCjQ6xU1htowmdl8ggyZ5OQyL+e J3uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771320822; x=1771925622; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=x8U/V9GGZCQ16QVrv/ncm3L2JAXBCx3yPL1lZ3d8azI=; b=tkhmKb56FxgppknSSpv9ZzLFhOMfhQwK/4y/RwEkoesfO6iHD596+3xebjr3vPuIaQ dg1zjIMP8W89AF2Zz+VqfY0N3At+qgvXOzIVuUaj0NHTEWrxDb0fIO4IxEo5EqTBOkaq v+hC4x1eCihoINuOyLyu1KjOIf1o/XfFCH4/l+1XwCpsSybei49KKKghkgxBYcj3LwII LYhyff5FkN1RPA/SN3WJ+hmvWwCgrCXL1P8cXY/AgrdrDH2Two62LpP9UuNeqDRcgYJ9 tuiGIxnTunMnSvXqdXvdf/oldJ5DJeRdH8FYQjMT7jcxqU7m7B5+LzMIjfOo2rQBVIvb dklw== X-Forwarded-Encrypted: i=1; AJvYcCXkauTn9MUd+1X2nck1Ceb67NNrnKmvbfGeclOO6YD7fLiVP7Vm2CDD4F/yJAG6wk4TwwlcGfHRy/JW+hk=@vger.kernel.org X-Gm-Message-State: AOJu0YyDvo5C9t1Xlu4Z30P08VhjRwn+McAGpPf25RKVtvs7rKM4HQjR r3NMIXZoIGf8kj6mWXT6MI3g1bLyjOV9UEqx67Md0Quzx+LmBdZx6S1BOFCtXUkvteBW566MNv6 E+/lSMs6HpLMteDCJcA== X-Received: from wmbz20.prod.google.com ([2002:a05:600c:c094:b0:47b:d5ad:dd7f]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:820d:b0:47d:403e:4eaf with SMTP id 5b1f17b1804b1-48379b9f278mr197567615e9.10.1771320822308; Tue, 17 Feb 2026 01:33:42 -0800 (PST) Date: Tue, 17 Feb 2026 09:33:40 +0000 In-Reply-To: <20260217091348.GT1395266@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <877bsgu7fb.fsf@kernel.org> <2026021313-embody-deprive-9da5@gregkh> <873434u3yq.fsf@kernel.org> <20260213142608.GV2995752@noisy.programming.kicks-ass.net> <2026021311-shorten-veal-532c@gregkh> <2026021326-stark-coastline-c5bc@gregkh> <20260217091348.GT1395266@noisy.programming.kicks-ass.net> Message-ID: Subject: Re: [PATCH v2] rust: page: add byte-wise atomic memory copy methods From: Alice Ryhl To: Peter Zijlstra Cc: Boqun Feng , Greg KH , Andreas Hindborg , Lorenzo Stoakes , "Liam R. Howlett" , Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Trevor Gross , Danilo Krummrich , Will Deacon , Mark Rutland , linux-mm@kvack.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Tue, Feb 17, 2026 at 10:13:48AM +0100, Peter Zijlstra wrote: > On Fri, Feb 13, 2026 at 08:19:17AM -0800, Boqun Feng wrote: > > Well, in standard C, technically memcpy() has the same problem as Rust's > > `core::ptr::copy()` and `core::ptr::copy_nonoverlapping()`, i.e. they > > are vulnerable to data races. Our in-kernel memcpy() on the other hand > > doesn't have this problem. Why? Because it's volatile byte-wise atomic > > per the implementation. > > Look at arch/x86/lib/memcpy_64.S, plenty of movq variants there. Not > byte-wise. movq is a valid implementation of 8 byte-wise copies. > Also, not a single atomic operation in sight. Relaxed atomics are just mov ops. Alice