[PATCH v5] eal: add seqlock
Mattias Rönnblom
mattias.ronnblom at ericsson.com
Mon May 2 06:51:12 CEST 2022
On 2022-05-01 22:17, Stephen Hemminger wrote:
> On Sun, 1 May 2022 16:03:27 +0200
> Mattias Rönnblom <mattias.ronnblom at ericsson.com> wrote:
>
>> +struct data {
>> + rte_seqlock_t lock;
>> +
>> + uint64_t a;
>> + uint64_t b __rte_cache_aligned;
>> + uint64_t c __rte_cache_aligned;
>> +} __rte_cache_aligned;
>
> This will end up taking 192 bytes per lock.
> Which is a lot especially if embedded in another structure.
"b" and "c" are cache-line aligned to increase the chance of exposing
any bugs in the seqlock implementation. With these annotations,
accessing all struct data's fields are multiple distinct interactions
with the memory hierarchy, instead of one atomic "request for ownership"
type operation for a particular cache line, from the core. At least that
what the difference would be in my simple mental model of the typical CPU.
You mention this because you think it serves as a bad example, or what
is the reason? The lock itself is much smaller than that, and not
cache-line aligned. "struct data" are only used by the unit tests.
I should have mentioned the reason for the __rte_cache_aligned as a comment.
More information about the dev
mailing list