--- a/src/percpu.rs +++ b/src/percpu.rs @@ -21,7 +21,7 @@ cpu_set::{LogicalCpuId, MAX_CPU_COUNT}, cpu_stats::{CpuStats, CpuStatsData}, ptrace::Session, - sync::{mcs::McsNode, CleanLockToken}, + sync::{mcs::McsNode, mcs::McsRawLock, CleanLockToken}, syscall::debug::SyscallDebugInfo, }; @@ -66,6 +66,11 @@ /// `u8::MAX` means unknown (no SRAT or APIC ID not listed). pub numa_node: Cell, + /// Pointer to the MCS lock this CPU is currently spinning on (for transitive PI). + /// `null` when not waiting on any lock. Set in McsRawLock::acquire() before + /// entering the spin loop, cleared upon acquisition. + pub waiting_on_lock: AtomicPtr, + // TODO: Put mailbox queues here, e.g. for TLB shootdown? Just be sure to 128-byte align it // first to avoid cache invalidation. pub profiling: Option<&'static crate::profiling::RingBuffer>, @@ -360,6 +365,7 @@ pi_donated_prio: AtomicU32::new(u32::MAX), current_prio: Cell::new(39), numa_node: Cell::new(u8::MAX), + waiting_on_lock: AtomicPtr::new(core::ptr::null_mut()), ptrace_flags: Cell::new(PtraceFlags::empty()), ptrace_session: RefCell::new(None), inside_syscall: Cell::new(false),