From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.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 4FD67428492 for ; Tue, 20 Jan 2026 12:40:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768912860; cv=none; b=faSoQBFkzT88IvQajYpo+/iN4pzyhD/zhyseKRufuMAnEk+K+F7zNdrv7CNH9tLJPOA9TJ/6QPDsNu1xiGN8EOnNppZii0eUm61qaFEqCL0jvykeolsvWJbbcxi+AhJ050XfNsRQDM8g3vZ7lm0tqUDaQpcLSdtUg8vmvtoHyCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768912860; c=relaxed/simple; bh=vFTKGGke7gcYt0Y24qQ4qECg4XQrgXTzFKM0gvn13TE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=psHEspA5fpR4rr2jOXPK6udng4smTFWTluQHgJXNPIRhBBmUiGlDhlNZJW3/Depaa44jwb0xOdfD0vrSuW7vThpYOjPT8KDpBH7g/9DQ+HTRu9m7L0s3A6fE9vwXb+5iOaYOTzTQBaeapUFsFHR+RAGRr46FHDt+2yQ1GZUICqs= 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=3ZvcGUFw; arc=none smtp.client-ip=209.85.208.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="3ZvcGUFw" Received: by mail-ed1-f74.google.com with SMTP id 4fb4d7f45d1cf-64db7bc9921so8566405a12.2 for ; Tue, 20 Jan 2026 04:40:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1768912858; x=1769517658; 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=WZRsF4NvxTK9k0YGvZ/neWvOZ1bis6ac+sRh2zfafCw=; b=3ZvcGUFwJY3tRPDE666ArVIz+J7eKTvfpv+AqpKm9bQ2+LuKcebohDx4nE6H1l72N1 jNGukDRZ5AO6u6yhMPdaPtRMsF2dtb6XArmty4SIfzIqg+49+XGaA8BdnGI9YbMdXKG9 Latgd5Uq3VtY/9l6KinOX/LYvXIk9eRa9+WhNVUIiluRZ17QYGFqBvj/8P1/jzs6lmyL pwE8Q/xoz5Qjm3GLcrfyDdp4D+82ArS5VAXaI15Dgg/LjDTSnhVuWu3+/W8NB8bbQ2eb MGA7tXi5faR2VV6ys3ml1IyJj6y0yjFJ94pzQaEP4BfwDeE6eF1pRAQ3RdmJZxqn0vl+ IW/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768912858; x=1769517658; 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=WZRsF4NvxTK9k0YGvZ/neWvOZ1bis6ac+sRh2zfafCw=; b=ZBVyLrg7nnaVtSvWm0wClfYENENTwN8eaUKFS38sJU+UuqQO5KKcUJhSatZRXJfqrU BgU19OUhuC8ac4Y43tmcHJ6r10z8zzqJDtWobjvvByhX8hqejPU8TW7uzfoZb62pEEo8 h3dlwAFiO2N/VMA+MLra31OCZjUXM3EhFzmwMQQfWJVot7pFGib0rJcexdPVrckK+q+L EjNXfGGeGVj25cpQm+6uEeUhIS1KQlPTtKmE+lKtE8+FDZ1YW+g6118Hk4SsyJ2gXItc yIY2LVMt+6V3kWrgoapIWIRhv6n4w1UdzrI8Jx66VOzGKTYfTYqKZqGFlNGOIW1HH6Li 4fag== X-Gm-Message-State: AOJu0YwuC9v7M0MVEcwExsldyTQG2O51g1BGeikrXdmfjdxKCT8WkmI3 ILj9JzboHm4HtItbfFsgq50lSshg0frpwddl81EWudGVXMa3SlgPtlMavUCuEwEmjgJ9qS214iX AR4b+xuEFoD79dcC2uw== X-Received: from edqp3.prod.google.com ([2002:aa7:d303:0:b0:64b:511b:32fc]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:3643:b0:64c:e9b6:14d7 with SMTP id 4fb4d7f45d1cf-654bb427f7amr8037497a12.24.1768912857702; Tue, 20 Jan 2026 04:40:57 -0800 (PST) Date: Tue, 20 Jan 2026 12:40:56 +0000 In-Reply-To: <20260120115207.55318-3-boqun.feng@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260120115207.55318-1-boqun.feng@gmail.com> <20260120115207.55318-3-boqun.feng@gmail.com> Message-ID: Subject: Re: [PATCH 2/2] rust: sync: atomic: Add atomic operation helpers over raw pointers From: Alice Ryhl To: Boqun Feng Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-fsdevel@vger.kernel.org, kasan-dev@googlegroups.com, Will Deacon , Peter Zijlstra , Mark Rutland , Gary Guo , Miguel Ojeda , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Elle Rhumsaa , "Paul E. McKenney" , Marco Elver , FUJITA Tomonori Content-Type: text/plain; charset="utf-8" On Tue, Jan 20, 2026 at 07:52:07PM +0800, Boqun Feng wrote: > In order to synchronize with C or external, atomic operations over raw > pointers, althought previously there is always an `Atomic::from_ptr()` > to provide a `&Atomic`. However it's more convenient to have helpers > that directly perform atomic operations on raw pointers. Hence a few are > added, which are basically a `Atomic::from_ptr().op()` wrapper. > > Note: for naming, since `atomic_xchg()` and `atomic_cmpxchg()` has a > conflict naming to 32bit C atomic xchg/cmpxchg, hence they are just > named as `xchg()` and `cmpxchg()`. For `atomic_load()` and > `atomic_store()`, their 32bit C counterparts are `atomic_read()` and > `atomic_set()`, so keep the `atomic_` prefix. > > Signed-off-by: Boqun Feng Reviewed-by: Alice Ryhl > +/// - `atomic_store(.., Relaxed)` maps to `WRITE_ONCE()` when using for inter-thread communication. typo: "when used for" Alice