Skip to content
Snippets Groups Projects
Commit 85dadc11 authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Merge remote-tracking branch 'origin/gh-885-trim-thread-pools'

parents 9086a8e3 1047bc11
No related branches found
No related tags found
No related merge requests found
......@@ -626,6 +626,25 @@ engine_init()
engine_register(sophia);
}
/**
* @brief Reduce the current number of threads in the thread pool to the
* bare minimum. Doesn't prevent the pool from spawning new threads later
* if demand mounts.
*/
static void
thread_pool_trim()
{
/*
* Trim OpenMP thread pool.
* Though we lack the direct control the workaround below works for
* GNU OpenMP library. The library stops surplus threads on entering
* a parallel region. Can't go below 2 threads due to the
* implementation quirk.
*/
#pragma omp parallel num_threads(2)
;
}
static inline void
box_init(void)
{
......@@ -696,6 +715,11 @@ box_init(void)
engine_end_recovery();
/*
* Recovery inflates the thread pool quite a bit (due to parallel sort).
*/
thread_pool_trim();
rmean_cleanup(rmean_box);
if (recovery_has_replica(recovery))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment