diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2017-11-03 16:47:21 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2018-01-17 13:36:54 -0500 |
commit | 903bbae76a2c690a7e91c9acaaa07648e4448ff9 (patch) | |
tree | 8cac5494ff4ac33e67ec02286fe4d6faa91e093d | |
parent | fbb20bc3b0e3f9274eeab9e8e2397821c8ab1853 (diff) | |
download | mongo-903bbae76a2c690a7e91c9acaaa07648e4448ff9.tar.gz |
SERVER-31818 Add server parameter to disable MarkThreadIdle
(cherry picked from commit 836ad1fdfae0243ecf88b4747e9ae4a1cd40a438)
-rw-r--r-- | src/mongo/util/tcmalloc_server_status_section.cpp | 7 |
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 c215956c0b3..e7623b068a1 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/db/service_context.h" #include "mongo/transport/transport_layer.h" #include "mongo/util/log.h" @@ -55,11 +56,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 (getGlobalServiceContext()->getTransportLayer()->sessionStats().numOpenSessions <= kManyClients) return; |