Skip to content

Commit 9bce68a

Browse files
authored
Merge pull request ceph#55641 from Matan-B/wip-matanb-crimson-alien-buf-v2
crimson/osd/main: Enable multicore client messenger Reviewed-by: Samuel Just <[email protected]> Reviewed-by: chunmei-liu <[email protected]>
2 parents 3e76b89 + c8d8f73 commit 9bce68a

File tree

6 files changed

+24
-5
lines changed

6 files changed

+24
-5
lines changed

src/crimson/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ set(crimson_common_srcs
2424
common/throttle.cc
2525
common/tmap_helpers.cc
2626
common/tri_mutex.cc
27+
common/buffer_seastar.cc
2728
crush/CrushLocation.cc)
2829

2930
# the specialized version of ceph-common, where
@@ -35,7 +36,6 @@ add_library(crimson-common STATIC
3536
${PROJECT_SOURCE_DIR}/src/common/bit_str.cc
3637
${PROJECT_SOURCE_DIR}/src/common/bloom_filter.cc
3738
${PROJECT_SOURCE_DIR}/src/common/buffer.cc
38-
${PROJECT_SOURCE_DIR}/src/common/buffer_seastar.cc
3939
${PROJECT_SOURCE_DIR}/src/common/ceph_argparse.cc
4040
${PROJECT_SOURCE_DIR}/src/common/ceph_context.cc
4141
${PROJECT_SOURCE_DIR}/src/common/ceph_crypto.cc

src/crimson/auth/KeyRing.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <seastar/core/future-util.hh>
1111
#include <seastar/core/reactor.hh>
1212

13-
#include "common/buffer_seastar.h"
13+
#include "crimson/common/buffer_seastar.h"
1414
#include "auth/KeyRing.h"
1515
#include "include/denc.h"
1616
#include "crimson/common/buffer_io.h"
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#include <seastar/core/sharded.hh>
1616
#include <seastar/net/packet.hh>
17+
#include <seastar/core/reactor.hh>
18+
#include <seastar/core/alien.hh>
1719

1820
#include "include/buffer_raw.h"
1921
#include "buffer_seastar.h"
@@ -24,9 +26,21 @@ namespace ceph::buffer {
2426

2527
class raw_seastar_foreign_ptr : public raw {
2628
seastar::foreign_ptr<temporary_buffer> ptr;
29+
seastar::alien::instance& alien;
2730
public:
2831
raw_seastar_foreign_ptr(temporary_buffer&& buf)
29-
: raw(buf.get_write(), buf.size()), ptr(std::move(buf)) {}
32+
: raw(buf.get_write(), buf.size()), ptr(std::move(buf)),
33+
alien(seastar::engine().alien()) {}
34+
35+
~raw_seastar_foreign_ptr() {
36+
if (!seastar::engine_is_ready()) {
37+
// we should let a seastar reactor destroy this memory, we are alien.
38+
seastar::alien::run_on(alien, ptr.get_owner_shard(),
39+
[_ptr = std::move(ptr)]() mutable noexcept {
40+
_ptr.reset();
41+
});
42+
}
43+
}
3044
};
3145

3246
class raw_seastar_local_ptr : public raw {

src/crimson/osd/main.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,13 @@ int main(int argc, const char* argv[])
186186
const auto nonce = crimson::osd::get_nonce();
187187
crimson::net::MessengerRef cluster_msgr, client_msgr;
188188
crimson::net::MessengerRef hb_front_msgr, hb_back_msgr;
189+
for (auto [msgr, name] : {make_pair(std::ref(client_msgr), "client"s)}) {
190+
msgr = crimson::net::Messenger::create(entity_name_t::OSD(whoami),
191+
name,
192+
nonce,
193+
false);
194+
}
189195
for (auto [msgr, name] : {make_pair(std::ref(cluster_msgr), "cluster"s),
190-
make_pair(std::ref(client_msgr), "client"s),
191196
make_pair(std::ref(hb_front_msgr), "hb_front"s),
192197
make_pair(std::ref(hb_back_msgr), "hb_back"s)}) {
193198
msgr = crimson::net::Messenger::create(entity_name_t::OSD(whoami),

src/test/crimson/test_denc.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <seastar/core/temporary_buffer.hh>
33
#include <gtest/gtest.h>
44
#include "include/denc.h"
5-
#include "common/buffer_seastar.h"
5+
#include "crimson/common/buffer_seastar.h"
66

77
using temporary_buffer = seastar::temporary_buffer<char>;
88
using buffer_iterator = seastar_buffer_iterator;

0 commit comments

Comments
 (0)