1
0
mirror of https://github.com/Zygo/bees.git synced 2025-07-06 02:22:27 +02:00

context: raise limit on the number of concurrent ioctls to cpu_cores/2

This might improve performance on systems with more than 3 CPU cores...or
it might bring such a machine to its knees.

TODO:  find out which of those two things happens.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell
2017-01-13 00:50:39 -05:00
parent 9cb48c35b9
commit 99fe452101
5 changed files with 13 additions and 8 deletions

View File

@ -1,6 +1,7 @@
#include "bees.h"
#include "crucible/limits.h"
#include "crucible/process.h"
#include "crucible/string.h"
#include <fstream>
@ -280,7 +281,7 @@ BeesContext::dedup(const BeesRangePair &brp)
// To avoid hammering all the cores with long-running ioctls,
// only do one dedup at any given time.
BEESNOTE("Waiting to dedup " << brp);
unique_lock<mutex> lock(bees_ioctl_mutex);
auto dedup_lock = bees_ioctl_lock_set.make_lock(gettid());
#endif
BEESNOTE("dedup " << brp);
@ -850,7 +851,7 @@ BeesContext::scan_forward(const BeesFileRange &bfr)
catch_all([&]() {
uint64_t extent_bytenr = e.bytenr();
BEESNOTE("waiting for extent bytenr " << to_hex(extent_bytenr));
decltype(m_extent_lock_set)::Lock extent_lock(m_extent_lock_set, extent_bytenr);
auto extent_lock = m_extent_lock_set.make_lock(extent_bytenr);
Timer one_extent_timer;
return_bfr = scan_one_extent(bfr, e);
BEESCOUNTADD(scanf_extent_ms, one_extent_timer.age() * 1000);
@ -886,7 +887,7 @@ BeesContext::resolve_addr_uncached(BeesAddress addr)
// To avoid hammering all the cores with long-running ioctls,
// only do one resolve at any given time.
BEESNOTE("waiting to resolve addr " << addr);
unique_lock<mutex> lock(bees_ioctl_mutex);
auto lock = bees_ioctl_lock_set.make_lock(gettid());
Timer resolve_timer;