Allow limiting the number of GC threads (+RTS -qn<n>)
authorSimon Marlow <marlowsd@gmail.com>
Sat, 9 Apr 2016 19:45:50 +0000 (20:45 +0100)
committerBen Gamari <ben@smart-cactus.org>
Thu, 25 Aug 2016 15:23:05 +0000 (11:23 -0400)
commit29f610da83bc3e0c47747fae8d672269b8d7ea50
tree279dcb285439f5a4eb7e1acf91860b676ee995e4
parent3219220db283aa09396fc5fd7fe1668ecbe7a512
Allow limiting the number of GC threads (+RTS -qn<n>)

This allows the GC to use fewer threads than the number of capabilities.
At each GC, we choose some of the capabilities to be "idle", which means
that the thread running on that capability (if any) will sleep for the
duration of the GC, and the other threads will do its work.  We choose
capabilities that are already idle (if any) to be the idle capabilities.

The idea is that this helps in the following situation:

* We want to use a large -N value so as to make use of hyperthreaded
  cores
* We use a large heap size, so GC is infrequent
* But we don't want to use all -N threads in the GC, because that
  thrashes the memory too much.

See docs for usage.

(cherry picked from commit 76ee260778991367b8dbf07ecf7afd31f826c824)
docs/users_guide/runtime_control.rst
includes/rts/Flags.h
rts/Capability.c
rts/Capability.h
rts/RtsFlags.c
rts/Schedule.c
rts/Task.h
rts/sm/GC.c