Skip to content

Commit

Permalink
reactor: don't call set_heap_profiling_enable() if not needed
Browse files Browse the repository at this point in the history
Seastar has a `heapprof` configuration option, which will cause the
reactor to enable heap-profiling on all shards. It does this by
unconditionally calling `memory::set_heap_profiling_enable()` with the
value of the configuration option, which might be false.
Since a091b5d `memory::set_heap_profiling_enable()` will print a
warning if called when `SEASTAR_HEAPPROF` is not defined. This results
in this message being printed on startup from each shard, which is
confusing and unexpected when one didn't set the `heapprof`
configuration at all. Change the code to only call
`memory::set_heap_profiling_enable()` if `heapprof` was set to true,
avoiding the noise when no heap-profiling is attempted to be used.

Signed-off-by: Botond Dénes <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
denesb authored and avikivity committed Feb 12, 2020
1 parent 6d2ed8c commit 7ba4407
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/reactor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3803,7 +3803,9 @@ void smp::configure(boost::program_options::variables_map configuration, reactor
}

bool heapprof_enabled = configuration.count("heapprof");
memory::set_heap_profiling_enabled(heapprof_enabled);
if (heapprof_enabled) {
memory::set_heap_profiling_enabled(heapprof_enabled);
}

#ifdef SEASTAR_HAVE_DPDK
if (smp::_using_dpdk) {
Expand Down Expand Up @@ -3870,7 +3872,9 @@ void smp::configure(boost::program_options::variables_map configuration, reactor
smp::pin(allocation.cpu_id);
}
memory::configure(allocation.mem, mbind, hugepages_path);
memory::set_heap_profiling_enabled(heapprof_enabled);
if (heapprof_enabled) {
memory::set_heap_profiling_enabled(heapprof_enabled);
}
sigset_t mask;
sigfillset(&mask);
for (auto sig : { SIGSEGV }) {
Expand Down

0 comments on commit 7ba4407

Please sign in to comment.