Skip to content

Use fair spinlocks in SMP #1488

@patacongo

Description

@patacongo

The spinlock implementation is very simple. Each CPU simply tries to acquire the spinlock via a test and set atomic operation, the first CPU to successfully perform the test and set is the "winner" and gets the spinlock. That CPU is complete arbitrary and not managed in any way.

This kind of spinlock can have adverse effects in SMP because under certain conditions other CPUs may always get the spinlock and one CPU can randomly be delayed for a significant amount of time.

We should consider replacing a fair spinlock implementation that enforces first-in, first out spinlocks. There are several fair spinlock algorithms. Some established and in common use, some simple and some complex, some straight-forward and some more controversial, some have undesirable side-effects. A first step would be to decide on an appropriate fair spinlock algorithm.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions