Fix hill climbing float overflow (#14505)
authorKoundinya Veluri <kouvel@users.noreply.github.com>
Thu, 19 Oct 2017 03:51:30 +0000 (20:51 -0700)
committerGitHub <noreply@github.com>
Thu, 19 Oct 2017 03:51:30 +0000 (20:51 -0700)
commita589e3926a1780256fdb52376f8681fe047daf54
tree2115b74f663d977b827dd1e8c47962617f47e767
parent4984a8dffda3b3f58fc158c48fc798d02ab1b98e
Fix hill climbing float overflow (#14505)

Fix hill climbing float overflow

- When hill climbing finds that it wants to decrease the thread count but can't because the thread count is already the minimum, it instead tries to increase the sampling interval by a factor of up to 10 depending on how much it wanted to decrease the thread count
- The ratio was being used incorrectly (used max instead of min), and sometimes the ratio can be so large that the conversion to int after the float math overflows
- If something in the process enabled floating point exceptions, it may also crash
  - There doesn't appear to be a clean way to disable hill climbing, added a config variable that disables it in case a workaround is necessary for some other reason in the future
- Fixed to avoid overflow in the math to what was probably intended
- There may be another bug in GetWaveComponent() that causes values of such high magnitude to be generated, I'll leave that investigation for when that in particular becomes a real issue
src/inc/clrconfigvalues.h
src/vm/hillclimbing.cpp
src/vm/win32threadpool.cpp
src/vm/win32threadpool.h