summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2017-11-03 16:47:21 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2018-01-17 13:44:15 -0500
commita7ffe65bd73e5254583a6304188d7efbd47c2574 (patch)
treeadc3e1b07acf6f40f63864a93b11f41c59fbb70e /src
parent385ed430991ed698ea4de674caddf526715f5f0d (diff)
downloadmongo-a7ffe65bd73e5254583a6304188d7efbd47c2574.tar.gz
SERVER-31818 Add server parameter to disable MarkThreadIdle
(cherry picked from commit 836ad1fdfae0243ecf88b4747e9ae4a1cd40a438)
Diffstat (limited to 'src')
-rw-r--r--src/mongo/util/tcmalloc_server_status_section.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/util/tcmalloc_server_status_section.cpp b/src/mongo/util/tcmalloc_server_status_section.cpp
index 8b43b8b4a66..c2404e4f94c 100644
--- a/src/mongo/util/tcmalloc_server_status_section.cpp
+++ b/src/mongo/util/tcmalloc_server_status_section.cpp
@@ -38,6 +38,7 @@
#include "mongo/base/init.h"
#include "mongo/db/commands/server_status.h"
+#include "mongo/db/server_parameters.h"
#include "mongo/util/concurrency/synchronization.h"
#include "mongo/util/log.h"
#include "mongo/util/net/listen.h"
@@ -53,11 +54,17 @@ const int kManyClients = 40;
stdx::mutex tcmallocCleanupLock;
+MONGO_EXPORT_SERVER_PARAMETER(tcmallocEnableMarkThreadIdle, bool, true);
+
/**
* Callback to allow TCMalloc to release freed memory to the central list at
* favorable times. Ideally would do some milder cleanup or scavenge...
*/
void threadStateChange() {
+ if (!tcmallocEnableMarkThreadIdle.load()) {
+ return;
+ }
+
if (Listener::globalTicketHolder.used() <= kManyClients)
return;