From 634e4a74bde8633406921fa4e6f675893348db5e Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Mon, 4 May 2026 14:06:12 -0700 Subject: [PATCH] rt: change `AtomicNotified` back to `AcqRel` (#8120) In #7431, I originally implemented `AtomicNotified` with the `AcqRel` atomic ordering, which is all that *should* be necessary here. While trying to debug a failing test on ARM, I changed it to `SeqCst`. This fixed the test, but was not actually necessary to solve the root cause of that test failure, which was ultimately fixed in #8008 instead. Using `SeqCst` here and locking the bus probably increases the overhead of using the LIFO slot substantially, so I've un-done that. --- tokio/src/runtime/task/atomic_notified.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tokio/src/runtime/task/atomic_notified.rs b/tokio/src/runtime/task/atomic_notified.rs index c5fc539bd..05a408755 100644 --- a/tokio/src/runtime/task/atomic_notified.rs +++ b/tokio/src/runtime/task/atomic_notified.rs @@ -4,7 +4,7 @@ use crate::runtime::task::{Header, Notified, RawTask}; use std::marker::PhantomData; use std::ptr; use std::ptr::NonNull; -use std::sync::atomic::Ordering::SeqCst; +use std::sync::atomic::Ordering::{AcqRel, Acquire}; /// An atomic cell which can contain a pointer to a [`Notified`] task. /// @@ -29,7 +29,7 @@ impl AtomicNotified { let new = task .map(|t| t.into_raw().header_ptr().as_ptr()) .unwrap_or_else(ptr::null_mut); - let old = self.task.swap(new, SeqCst); + let old = self.task.swap(new, AcqRel); NonNull::new(old).map(|ptr| unsafe { // Safety: since we only allow tasks with the same scheduler type to // be placed in this cell, we know that the pointed task's scheduler @@ -43,7 +43,7 @@ impl AtomicNotified { } pub(crate) fn is_some(&self) -> bool { - !self.task.load(SeqCst).is_null() + !self.task.load(Acquire).is_null() } }