Browse files

Add support for scheduler utilization balancing

For more information see documentation of the new command line argument +sub
  • Loading branch information...
rickard-green committed Jan 16, 2014
1 parent fc8cc00 commit e7ea832a4a3a8ba2f94ce02a47ca34b60277cb0a
Showing with 525 additions and 57 deletions.
  1. +27 −0 erts/doc/src/erl.xml
  2. +26 −0 erts/emulator/beam/erl_init.c
  3. +382 −42 erts/emulator/beam/erl_process.c
  4. +89 −15 erts/emulator/beam/erl_process.h
  5. +1 −0 erts/etc/common/erlexec.c
@@ -941,6 +941,10 @@
when schedulers frequently run out of work. When disabled,
the frequency with which schedulers run out of work will
not be taken into account by the load balancing logic.
<br/>&nbsp;&nbsp;<c>+scl false</c> is similar to
<seealso marker="#+sub">+sub true</seealso> with the difference
that <c>+sub true</c> also will balance scheduler utilization
between schedulers.
<tag><marker id="+sct"><c>+sct CpuTopology</c></marker></tag>
@@ -1087,6 +1091,29 @@
documentation of the <seealso marker="#+sbt">+sbt</seealso> flag.
<tag><marker id="+sub"><c>+sub true|false</c></marker></tag>
<p>Enable or disable
<seealso marker="erts:erlang#statistics_scheduler_wall_time">scheduler
utilization</seealso> balancing of load. By default scheduler
utilization balancing is disabled and instead scheduler
compaction of load is enabled which will strive for a load
distribution which causes as many scheduler threads as possible
to be fully loaded (i.e., not run out of work). When scheduler
utilization balancing is enabled the system will instead try to
balance scheduler utilization between schedulers. That is,
strive for equal scheduler utilization on all schedulers.
<br/>&nbsp;&nbsp;&nbsp;<c>+sub true</c> is only supported on
systems where the runtime system detects and use a monotonically
increasing high resolution clock. On other systems, the runtime
system will fail to start.
<br/>&nbsp;&nbsp;&nbsp;<c>+sub true</c> implies
<seealso marker="#+scl">+scl false</seealso>. The difference
between <c>+sub true</c> and <c>+scl false</c> is that
<c>+scl false</c> will not try to balance the scheduler
<tag><marker id="+swct"><c>+sws very_eager|eager|medium|lazy|very_lazy</c></marker></tag>
@@ -537,6 +537,12 @@ void erts_usage(void)
erts_fprintf(stderr, " see the erl(1) documentation for more info.\n");
erts_fprintf(stderr, "-sct cput set cpu topology,\n");
erts_fprintf(stderr, " see the erl(1) documentation for more info.\n");
erts_fprintf(stderr, "-sub bool enable/disable scheduler utilization balancing,\n");
erts_fprintf(stderr, "-sub false disable scheduler utilization balancing,\n");
erts_fprintf(stderr, " see the erl(1) documentation for more info.\n");
erts_fprintf(stderr, "-sws val set scheduler wakeup strategy, valid values are:\n");
erts_fprintf(stderr, " default|legacy.\n");
erts_fprintf(stderr, "-swct val set scheduler wake cleanup threshold, valid values are:\n");
@@ -1512,6 +1518,26 @@ erl_start(int argc, char **argv)
else if (has_prefix("ub", sub_param)) {
arg = get_arg(sub_param+2, argv[i+1], &i);
if (sys_strcmp("true", arg) == 0) {
erts_sched_balance_util = 1;
"scheduler utilization balancing not "
"supported on this system\n");
else if (sys_strcmp("false", arg) == 0)
erts_sched_balance_util = 0;
else {
erts_fprintf(stderr, "bad scheduler utilization balancing "
" value '%s'\n", arg);
else if (has_prefix("wct", sub_param)) {
arg = get_arg(sub_param+3, argv[i+1], &i);
if (erts_sched_set_wake_cleanup_threshold(arg) != 0) {
Oops, something went wrong.

0 comments on commit e7ea832

Please sign in to comment.