Skip to content

Fix cache alignment issues for software interrupt tracking #323

Open
@bushidocodes

Description

@bushidocodes

Oh no! These are not cache aligned. This is a large amount of false sharing that will cause a big perf decrease on multicore.

We want to essentially have each atomic be 128 bytes apart (on 128-aligned boundaries). The typical way to accomplish this without blowing up the cache and memory consumption is to put the counters in a struct, and align the structs.

struct event_counts {
    _Atomic volatile sig_atomic_t software_interrupt_counts_sigalarm_reply;
    _Atomic volatile sig_atomic_t software_interrupt_counts_kernel;
    /* ... */     
} __attribute((aligned(128)));

struct event_counts software_interrupt_counts[runtime_worker_threads_count];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions