schedulePushWork: avoid unnecessary wakeups

Authored by simonmar on Apr 24 2016, 3:31 PM.

Description

schedulePushWork: avoid unnecessary wakeups

This function had some pathalogically bad behaviour: if we had 2 threads
on the current capability and 23 other idle capabilities, we would

  • grab all 23 capabilities
  • migrate one Haskell thread to one of them
  • wake up a worker on *all* 23 other capabilities.

This lead to a lot of unnecessary wakeups when using large -N values.

Now, we

  • Count how many capabilities we need to wake up
  • Start from cap->no+1, so that we don't overload low-numbered capabilities
  • Only wake up capabilities that we migrated a thread to (unless we have sparks to steal)

This results in a pretty dramatic improvement in our production system.

Details

Committed
simonmarMay 4 2016, 7:30 AM
Parents
rGHCf703fd6b50f0: Add +RTS -AL<size>
Branches
Unknown
Tags
Unknown