-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Priority inversion avoidance in Actor Runtime #41362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please test |
|
||
bool wasInlineJob() const { | ||
return Kind == Inline; | ||
} | ||
|
||
static RunningJobInfo forOther(JobPriority priority) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since JobPriority of the processing job does not necessarily correlate to the priority of the actor we're processing, or the priority of the thread running that job (as a result of priority escalation that can happen asynchronously or as a result of self-overrides), I decided to remove it from this structured, since we can't make scheduling decisions based on this information.
Build failed |
@swift-ci please test |
Build failed |
job = new (&JobStorage) ProcessInlineJob(priority); | ||
} else { | ||
assert(false && "Should not be here - we don't have support for any OOL actor process jobs yet"); | ||
// TODO (rokhinip): Don't we need to take a +1 per ref count rules specified? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds right. A comment pointing to the corresponding release would be handy.
currentActor->giveUpThread(runner); | ||
} | ||
|
||
// We are eliminating a processing job for the original actor, release it. | ||
swift_release(actor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually about 80% certain that this is wrong to be here since we're only scheduling with inline jobs and we don't ever take extra ref counts on the actor since we don't create extra processing jobs.
Edit: Turns out we take a retain in ProcessInlineJob::process
and ProcessOutOfLineJob::process
so we need this release. But why do we need to take the retain there @rjmccall? Per your ownership rules, if anything it seems like we should be taking the retain at the time of scheduling the extra processing jobs?
84a8e5f
to
72d15f6
Compare
@swift-ci please test |
72d15f6
to
3865ae6
Compare
@swift-ci please test |
} | ||
|
||
// Only for static assert use below, not for actual use otherwise | ||
static constexpr size_t offsetOfActiveActorStatus() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only way I could think of doing this since the class members are private and so the static_assert() was unhappy.
state of the actor similar to the ActiveTaskStatus. Refactor the default actor runtime implementation to set us up for priority escalation support Radar-Id: rdar://problem/86100521
ActiveActorStatus Radar-Id: rdar://problem/86100521
Radar-Id: rdar://problem/86100521
DefaultActor Radar-Id: rdar://problem/86100521
3865ae6
to
a3e3c3f
Compare
@swift-ci please test |
This PR comes in 3 parts:
Rdar: rdar://86100521