diff options
author | Radoslaw Zarzynski <rzarzyns@redhat.com> | 2018-02-09 16:19:10 +0100 |
---|---|---|
committer | Radoslaw Zarzynski <rzarzyns@redhat.com> | 2018-02-27 11:38:48 +0100 |
commit | b265ed2955570c17b954270e6a1449637790e9b8 (patch) | |
tree | 778bfba8bf30c6d37c219d9a8d123b7d07b4866d /src/common/dout.h | |
parent | core: make SubsystemMap more statical and optimize should_gather(). (diff) | |
download | ceph-b265ed2955570c17b954270e6a1449637790e9b8.tar.xz ceph-b265ed2955570c17b954270e6a1449637790e9b8.zip |
core: hint the dout()'s message crafting as a cold code.
The idea is to:
1. Do not put the dout()'s crafting stuff on the hot, fall-through
path. Cheapest branches are those that are forward and never taken.
2. Move it to separated sections placed far away from the main path
to be more friendly to ICache and ITLB. That is, dout_impl constructs
a function now.
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
Diffstat (limited to 'src/common/dout.h')
-rw-r--r-- | src/common/dout.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/common/dout.h b/src/common/dout.h index 085773d74a9..5fb93e9030f 100644 --- a/src/common/dout.h +++ b/src/common/dout.h @@ -20,6 +20,7 @@ #include "global/global_context.h" #include "common/config.h" +#include "common/compiler_extensions.h" #include "common/likely.h" #include "common/Clock.h" #include "log/Log.h" @@ -78,7 +79,8 @@ struct is_dynamic<dynamic_marker_t<T>> : public std::true_type {}; } \ }(cct); \ \ - if (should_gather) { \ + if (unlikely(should_gather)) { \ + [&]() HINT_NO_INLINE HINT_COLD_CODE { \ static size_t _log_exp_length = 80; \ ceph::logging::Entry *_dout_e = \ cct->_log->create_entry(v, sub, &_log_exp_length); \ @@ -108,7 +110,8 @@ struct is_dynamic<dynamic_marker_t<T>> : public std::true_type {}; // /usr/include/assert.h clobbers our fancier version. #define dendl_impl std::flush; \ _ASSERT_H->_log->submit_entry(_dout_e); \ - } \ + }(); \ + } \ } while (0) #define dendl dendl_impl |