diff --git a/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs b/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs index 1fe4a45f335d..ef14425da230 100644 --- a/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs +++ b/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs @@ -1112,10 +1112,10 @@ internal struct Slot /// Padded head and tail indices, to avoid false sharing between producers and consumers. [DebuggerDisplay("Head = {Head}, Tail = {Tail}")] - [StructLayout(LayoutKind.Explicit, Size = 192)] // padding before/between/after fields based on typical cache line size of 64 + [StructLayout(LayoutKind.Explicit, Size = 384)] // padding before/between/after fields based on worst case cache line size of 128 internal struct PaddedHeadAndTail { - [FieldOffset(64)] public int Head; - [FieldOffset(128)] public int Tail; + [FieldOffset(128)] public int Head; + [FieldOffset(256)] public int Tail; } } diff --git a/src/System.Threading.Tasks.Dataflow/src/Internal/ProducerConsumerQueues.cs b/src/System.Threading.Tasks.Dataflow/src/Internal/ProducerConsumerQueues.cs index d14fd60cec6a..44b10b3dc83f 100644 --- a/src/System.Threading.Tasks.Dataflow/src/Internal/ProducerConsumerQueues.cs +++ b/src/System.Threading.Tasks.Dataflow/src/Internal/ProducerConsumerQueues.cs @@ -551,7 +551,7 @@ static class PaddingHelpers } /// Padding structure used to minimize false sharing in SingleProducerSingleConsumerQueue{T}. - [StructLayout(LayoutKind.Explicit, Size = PaddingHelpers.CACHE_LINE_SIZE - sizeof(Int32))] // Based on common case of 64-byte cache lines + [StructLayout(LayoutKind.Explicit, Size = PaddingHelpers.CACHE_LINE_SIZE - sizeof(Int32))] struct PaddingFor32 { }