Commit 2c7607f0 authored by JiaJie Ye's avatar JiaJie Ye Committed by Facebook Github Bot

Move hardcoded asan multiplier to a config

Summary: This export the 16 times stack size for ASAN TSAN into a config as @[655434592:Andrii Grynenko] suggested

Reviewed By: yfeldblum

Differential Revision: D9685364

fbshipit-source-id: 4c76e99ba10d0fad65dd0dc30eeb003b25514c43
parent a0988616
......@@ -37,13 +37,11 @@ namespace fibers {
namespace {
inline FiberManager::Options preprocessOptions(FiberManager::Options opts) {
#if defined(FOLLY_SANITIZE_ADDRESS) || defined(FOLLY_SANITIZE_THREAD)
/* Sanitizers need a lot of extra stack space.
16x is a conservative estimate, 8x also worked with tests
where it mattered. Note that overallocating here does not necessarily
increase RSS, since unused memory is pretty much free. */
opts.stackSize *= 16;
#endif
/**
* Adjust the stack size according to the multiplier config.
* Typically used with sanitizers, which need a lot of extra stack space.
*/
opts.stackSize *= std::exchange(opts.stackSizeMultiplier, 1);
return opts;
}
......
......@@ -85,6 +85,14 @@ 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. Note that
* over-allocating here does not necessarily increase RSS, since unused
* memory is pretty much free.
*/
size_t stackSizeMultiplier{kIsSanitize ? 16 : 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