[erlang-patches] Disable scheduler sleep

Rickard Green rickard@REDACTED
Wed Jun 12 00:40:58 CEST 2013


> For the OTP team's consideration ... Disable scheduler sleep
>
> For use in conjunction with "+scl false", for example:
>
>     erl +scl false +zdnfgtse 500:500
>
> See the discussion in these mailing list threads for more
> background:
>
> * http://erlang.org/pipermail/erlang-questions/2013-April/073490.html
> * http://erlang.org/pipermail/erlang-bugs/2013-May/003529.html
>
> As noted in the email threads, all R15B releases as well as R16B are
> vulnerable to the schedulers falling asleep too agressively.  I've also
> tested the future will-eventually-be-R16B01 from the OTP team's source
> repo's "maint" branch, as described by:
>
>     % git log | head -6
>     commit a70d09b6e611771b467a91c7ebeca1e14390553a
>     Merge: 8260029 fb8cbfa
>     Author: Fredrik Gustafsson <fredrik@REDACTED>
>     Date:   Fri May 17 10:03:30 2013 +0200
>
>         Merge branch 'nm/mnesia_idx_insert_speedup/OTP-11103' into maint
>
> ... and it is vulnerable, also.
>
> Patch info:
>
> git fetch git://github.com/slfritchie/otp.git disable-scheduler-sleeps
>
> https://github.com/slfritchie/otp/compare/erlang:maint...disable-scheduler-sleeps
> https://github.com/slfritchie/otp/compare/erlang:maint...disable-scheduler-sleeps.patch
>
> With this patch, release R16B and the today's "maint" branch are not
> vulnerable when run with "erl +scl false +zdnfgtse 500:500".
>
> This patch may be applied to the R15B releases and works correctly.
> The "patch" utility will complain about some fuzz, but it should not
> actually fail.
>
> -Scott
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches


I've rejected this patch, but implemented something that behaves in a 
similar way but without latency issues. This should make it into R16B01 
unless something unforeseen occurs. From the documentation:

      +sfwi Interval
          Set scheduler forced wakeup interval. All run queues will be 
scanned
          each Interval milliseconds. While there are sleeping schedulers in
          the system, one scheduler will be woken for each non-empty run 
queue
          found. An Interval of zero disables this feature, which also 
is the
          default.

          This feature has been introduced as a temporary workaround for 
lengthy
          executing native code, and native code that do not bump reductions
          properly in OTP. When these bugs have be fixed the +sfwi flag will
          be removed.

Regards,
Rickard
-- 
Rickard Green, Erlang/OTP, Ericsson AB.



More information about the erlang-patches mailing list