Skip to content

Commit dc3d374

Browse files
lexprfuncallfacebook-github-bot
authored andcommitted
Add a flag to control the MemoryIdler stack unmapping
Summary: Context is S499522. This gives the same control over stack mapping that exists for arena purging. Differential Revision: D74694322 fbshipit-source-id: 045f6e593d20a4e23e2bc6bc34ea852c8391c94d
1 parent ad92571 commit dc3d374

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

third-party/folly/src/folly/detail/MemoryIdler.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ FOLLY_GFLAGS_DEFINE_bool(
3939
false,
4040
"if enabled, folly memory-idler purges jemalloc arenas on thread idle");
4141

42+
FOLLY_GFLAGS_DEFINE_bool(
43+
folly_memory_idler_madvise_stacks,
44+
true,
45+
"if enabled, folly memory-idler madvises dontneed stacks on thread idle");
46+
4247
namespace folly {
4348
namespace detail {
4449

@@ -185,6 +190,10 @@ FOLLY_NOINLINE static uintptr_t getStackPtr() {
185190
}
186191

187192
void MemoryIdler::unmapUnusedStack(size_t retain) {
193+
if (!FLAGS_folly_memory_idler_madvise_stacks) {
194+
return;
195+
}
196+
188197
if (!isUnmapUnusedStackAvailable()) {
189198
return;
190199
}

0 commit comments

Comments
 (0)