Skip to content

Kernel: Add a WaitQueue::wait_until() overload that doesn't need a lock - #26932

Merged
LucasChollet merged 1 commit into
SerenityOS:masterfrom
spholz:kernel-waitqueue-without-lock
Aug 13, 2026
Merged

Kernel: Add a WaitQueue::wait_until() overload that doesn't need a lock#26932
LucasChollet merged 1 commit into
SerenityOS:masterfrom
spholz:kernel-waitqueue-without-lock

Conversation

@spholz

@spholz spholz commented Aug 13, 2026

Copy link
Copy Markdown
Member

Unlike condition variables, our WaitQueue implementation works correctly without requiring a lock. Users of this overload just need to be sure that the should_wake callback is done in an atomic way. See https://read.seas.harvard.edu/cs1610/2026/doc/wait-queues/ (the site we used as an implementation reference) for a good explanation why this is the case, especially the "Synchronization" section.

This allows us to remove a dummy spinlock from the WaitQueue in the E1000 driver.

Unlike condition variables, our WaitQueue implementation works correctly
without requiring a lock. Users of this overload just need to be sure
that the `should_wake` callback is done in an atomic way.
See https://read.seas.harvard.edu/cs1610/2026/doc/wait-queues/
(the site we used as an implementation reference) for a good explanation
why this is the case, especially the "Synchronization" section.

This allows us to remove a dummy spinlock from the WaitQueue in the
E1000 driver.
@github-actions github-actions Bot added the 馃憖 pr-needs-review PR needs review from a maintainer or community member label Aug 13, 2026

@LucasChollet LucasChollet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! (And sorry that I forgot to do it myself)

@LucasChollet
LucasChollet merged commit 423924b into SerenityOS:master Aug 13, 2026
14 checks passed
@github-actions github-actions Bot removed the 馃憖 pr-needs-review PR needs review from a maintainer or community member label Aug 13, 2026
@spholz
spholz deleted the kernel-waitqueue-without-lock branch August 13, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants