diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/cpp/coroutine/engine/stack/stack_common.h | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/coroutine/engine/stack/stack_common.h')
-rw-r--r-- | library/cpp/coroutine/engine/stack/stack_common.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/library/cpp/coroutine/engine/stack/stack_common.h b/library/cpp/coroutine/engine/stack/stack_common.h new file mode 100644 index 0000000000..ed2d74d296 --- /dev/null +++ b/library/cpp/coroutine/engine/stack/stack_common.h @@ -0,0 +1,35 @@ +#pragma once + +#include <cstdint> + +class TContExecutor; + +namespace NCoro::NStack { + + static constexpr uint64_t PageSize = 4096; + static constexpr uint64_t PageSizeMask = PageSize - 1; // for checks + static constexpr uint64_t DebugOrSanStackMultiplier = 4; // for debug or sanitizer builds + static constexpr uint64_t SmallStackMaxSizeInPages = 6; + + enum class EGuard { + Canary, //!< writes some data to check it for corruption + Page, //!< prohibits access to page memory + }; + + struct TPoolAllocatorSettings { + uint64_t RssPagesToKeep = 1; + uint64_t SmallStackRssPagesToKeep = 1; // for stack less than SmallStackMaxSizeInPages + uint64_t ReleaseRate = 2; +#if !defined(_san_enabled_) && defined(NDEBUG) + uint64_t StacksPerChunk = 256; +#else + uint64_t StacksPerChunk = 2; +#endif + }; + + struct TAllocatorStats { + uint64_t ReleasedSize = 0; + uint64_t NotReleasedSize = 0; + uint64_t NumOfAllocated = 0; + }; +} |