Skip to content

Commit

Permalink
Don't reschedule unmuted actors with no work
Browse files Browse the repository at this point in the history
  • Loading branch information
Benoit Vey authored and SeanTAllen committed Sep 25, 2020
1 parent 08cd459 commit f7996d0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/libponyrt/sched/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -1478,11 +1478,15 @@ bool ponyint_sched_unmute_senders(pony_ctx_t* ctx, pony_actor_t* actor)
if(!has_flag(to_unmute, FLAG_UNSCHEDULED))
{
ponyint_unmute_actor(to_unmute);
// TODO: we don't want to reschedule if our queue is empty.
// That's wasteful.
ponyint_sched_add(ctx, to_unmute);
DTRACE2(ACTOR_SCHEDULED, (uintptr_t)sched, (uintptr_t)to_unmute);
actors_rescheduled++;

// Only reschedule if the queue isn't empty. The queue hasn't been
// marked as empty when the actor was muted.
if(!ponyint_messageq_markempty(&to_unmute->q))
{
ponyint_sched_add(ctx, to_unmute);
DTRACE2(ACTOR_SCHEDULED, (uintptr_t)sched, (uintptr_t)to_unmute);
actors_rescheduled++;
}
}

ponyint_sched_start_global_unmute(ctx->scheduler->index, to_unmute);
Expand Down

0 comments on commit f7996d0

Please sign in to comment.