Commit cafcd901 authored by Eugene Poliukhovych's avatar Eugene Poliukhovych Committed by Facebook GitHub Bot

Set ASAN fiber stack overhead to 4x from 16x

Summary:
Originally set in D1315038, 16x overhead for stacksize for ASAN was too
pessimistic. The assumption that pre-allocating fiber stacks does not increase
process RSS was incorrect. As a result, fiber-heavy services consume way too
much memory when ASAN is enabled.

Reviewed By: yfeldblum

Differential Revision: D33754702

fbshipit-source-id: 7d0f3eb8aff8f3b7d17ac4a4960f5072822df05f
parent 90781bd9
......@@ -89,14 +89,18 @@ class FiberManager : public ::folly::Executor {
size_t stackSize{kDefaultStackSize};
/**
* Sanitizers need a lot of extra stack space. 16x is a conservative
* estimate, but 8x also worked with tests where it mattered. Similarly,
* debug builds need extra stack space due to reduced inlining.
* Sanitizers need a lot of extra stack space. Benchmarks results at
* https://www.usenix.org/system/files/conference/atc12/atc12-final39.pdf,
* table 2, show that average stack increase with ASAN is 10% and extreme is
* 306%. Setting to 400% as "works for majority of clients" setting. If
* stack data layout of the service leads to even higher ASAN memory
* overhead, those services can tune their fiber stack sizes further.
*
* Even in the absence of ASAN, debug builds still need extra stack space
* due to reduced inlining.
*
* Note that over-allocating here does not necessarily increase RSS, since
* unused memory is pretty much free.
*/
size_t stackSizeMultiplier{kIsSanitize ? 16 : (kIsDebug ? 2 : 1)};
size_t stackSizeMultiplier{kIsSanitize ? 4 : (kIsDebug ? 2 : 1)};
/**
* Record exact amount of stack used.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment