Page MenuHomeFreeBSD

sched_ule: Ensure we hold the thread lock when modifying td_flags
ClosedPublic

Authored by markj on Jul 14 2022, 8:06 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 23, 5:56 AM
Unknown Object (File)
Sun, Sep 22, 7:57 PM
Unknown Object (File)
Sun, Sep 22, 2:12 PM
Unknown Object (File)
Tue, Sep 17, 11:29 PM
Unknown Object (File)
Tue, Sep 17, 9:49 AM
Unknown Object (File)
Sun, Sep 15, 2:51 PM
Unknown Object (File)
Tue, Sep 10, 7:07 AM
Unknown Object (File)
Mon, Sep 9, 1:30 AM
Subscribers

Details

Summary

The load balancer may force a running thread to reschedule and pick a
new CPU. To do this it sets some flags in the thread running on a
loaded CPU. But it assumes that the thread's lock is equal to that of
the runqueue, and there are small windows where this is not true. In
this case, we can end up with non-atomic modifications to td_flags.

Since this load balancing is best-effort, simply give up if the thread's
lock doesn't match; in this case the thread is about to enter the
scheduler anyway.

Reported by: glebius
Fixes: e745d729be60 ("sched_ule(4): Improve long-term load balancer.")

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 46444
Build 43333: arc lint + arc unit