From nobody Tue Feb 10 10:54:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B7BFC77B73 for ; Wed, 31 May 2023 15:00:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233565AbjEaPAw (ORCPT ); Wed, 31 May 2023 11:00:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233543AbjEaPAr (ORCPT ); Wed, 31 May 2023 11:00:47 -0400 Received: from mail-ed1-x54a.google.com (mail-ed1-x54a.google.com [IPv6:2a00:1450:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0441B107 for ; Wed, 31 May 2023 08:00:42 -0700 (PDT) Received: by mail-ed1-x54a.google.com with SMTP id 4fb4d7f45d1cf-514b8d2b21fso893088a12.1 for ; Wed, 31 May 2023 08:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685545240; x=1688137240; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=v7AwI9/GAng9F6JU881/rPRp6iZXP9LwiNNuLduw3ys=; b=OMfl8/Z1UwxPwIyaHYkJ8H7XXz53ExBje25D3fSggmAEgqJKexyNv/r05uILaNVDH3 T5pW/a/d7fWKUhDGhaJRx9W6nzSAhQEKxq4NCO9CY3nxTH5muUNEJCcdJEwE4FDKS5YE mYtD4BXfm5MS0N3+F6W6wTY8BVSX/OtnsTIl/ym9yDrzKwkqbJuxky5teH0ZIc6hZGV+ 4zu2xJq1E0BdirdqaHNQC6za3BZrmsP+frmwlo6ZL3kMQZ+wZwP9hNv7crfRZDRjX8oC c0qI0l8MuhuhbctU5kMcULymtY0J4dWQT3OiUwRNBTlaEv30nTmYbag6K13T0WiAy6ga xXMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685545240; x=1688137240; 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=v7AwI9/GAng9F6JU881/rPRp6iZXP9LwiNNuLduw3ys=; b=al7UXEMwXm+nJZj+px7Ron3P3P9L3hpYHBGA8oofgTcaHcmhmlVgWOaCxTRgVwBbTo lT/f3ZCi2FYoae5DH/KfgsUCEjGkpd7Rue16Zt++B7nKV5gh+YJe4EzkfZXse+8UL3h6 +IJ9+Wh6rS1WGKVH4cq3Hbwi2l+t6Nvcc1xI9q9dtWDnNjbryIN2s+Bku70hC3hf64S4 p86aJN3s1nz4SlN1F2/0cFrgiinhxOUqeKnQ9brBs8NmbKl9AANnRoHJ7XaYzjKgPs40 gDPtfMRRze6lURduZeXi9Eb1yipbe9SnCetau8wh5OYiAdWVmPdTi2YDX2Zb2RjxaDvK 2+OA== X-Gm-Message-State: AC+VfDxwIQA1oVnnQHTFdayIZ3ZsYtcCmbnCQ4B5FVPQ5oyJbY1U4P0J sIPognhAHI7O1trkCRdYUSP4D1YesnhGR/s= X-Google-Smtp-Source: ACHHUZ68XPwYHak3RB9bb2krSE7KWIbi6M9HKaemsTXiQeyDGltkWQmmatoHjKKHCoSRCi/az8D3w9Kajgq9dOk= X-Received: from aliceryhl.c.googlers.com ([fda3:e722:ac3:cc00:31:98fb:c0a8:6c8]) (user=aliceryhl job=sendgmr) by 2002:a50:cdc1:0:b0:504:fcf5:63ee with SMTP id h1-20020a50cdc1000000b00504fcf563eemr1888238edj.0.1685545240591; Wed, 31 May 2023 08:00:40 -0700 (PDT) Date: Wed, 31 May 2023 14:59:36 +0000 In-Reply-To: <20230531145939.3714886-1-aliceryhl@google.com> Mime-Version: 1.0 References: <20230531145939.3714886-1-aliceryhl@google.com> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog Message-ID: <20230531145939.3714886-2-aliceryhl@google.com> Subject: [PATCH v3 1/4] rust: sync: reword the `Arc` safety comment for `Send` From: Alice Ryhl To: rust-for-linux@vger.kernel.org Cc: Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor , Boqun Feng , Gary Guo , "=?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?=" , Benno Lossin , Alice Ryhl , Ingo Molnar , Peter Zijlstra , Will Deacon , Mark Rutland , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Andreas Hindborg , Martin Rodriguez Reboredo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The safety comment on `impl Send for Arc` talks about "directly" accessing the value, when it really means "accessing the value with a mutable reference". This commit clarifies that. Suggested-by: Boqun Feng Signed-off-by: Alice Ryhl Reviewed-by: Andreas Hindborg Reviewed-by: Boqun Feng Reviewed-by: Gary Guo Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Benno Lossin --- rust/kernel/sync/arc.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs index e6d206242465..3ad831603cf4 100644 --- a/rust/kernel/sync/arc.rs +++ b/rust/kernel/sync/arc.rs @@ -146,8 +146,8 @@ impl, U: ?Sized> core::ops::Dispa= tchFromDyn> for Ar =20 // SAFETY: It is safe to send `Arc` to another thread when the underlyi= ng `T` is `Sync` because // it effectively means sharing `&T` (which is safe because `T` is `Sync`)= ; additionally, it needs -// `T` to be `Send` because any thread that has an `Arc` may ultimately= access `T` directly, for -// example, when the reference count reaches zero and `T` is dropped. +// `T` to be `Send` because any thread that has an `Arc` may ultimately= access `T` using a +// mutable reference when the reference count reaches zero and `T` is drop= ped. unsafe impl Send for Arc {} =20 // SAFETY: It is safe to send `&Arc` to another thread when the underly= ing `T` is `Sync` for the --=20 2.41.0.rc0.172.g3f132b7071-goog