From: Frederic Suter Date: Thu, 7 Mar 2019 23:13:08 +0000 (+0100) Subject: poor damage control for tonight only X-Git-Tag: v3_22~148 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/fa5d9ddd01e1df9404b317e2d53878b5f1f2a854 poor damage control for tonight only --- diff --git a/src/msg/msg_process.cpp b/src/msg/msg_process.cpp index 2b22f1e36a..e4acc92281 100644 --- a/src/msg/msg_process.cpp +++ b/src/msg/msg_process.cpp @@ -71,22 +71,25 @@ msg_process_t MSG_process_create_with_environment(const char *name, xbt_main_fun if (code) function = simgrid::xbt::wrap_main(code, argc, static_cast(argv)); - simgrid::s4u::ActorPtr actor = simgrid::s4u::Actor::init(std::move(name), host); - actor->extension()->set_user_data(data); - - xbt_dict_cursor_t cursor = nullptr; - char* key; - char* value; - xbt_dict_foreach (properties, cursor, key, value) - actor->set_property(key, value); - xbt_dict_free(&properties); + simgrid::s4u::ActorPtr actor; try { - actor->start(std::move(function)); + if (data != nullptr) { + actor = simgrid::s4u::Actor::init(std::move(name), host); + actor->extension()->set_user_data(data); + xbt_dict_cursor_t cursor = nullptr; + char* key; + char* value; + xbt_dict_foreach (properties, cursor, key, value) + actor->set_property(key, value); + actor->start(std::move(function)); + } else + actor = simgrid::s4u::Actor::create(std::move(name), host, std::move(function)); } catch (simgrid::HostFailureException const&) { xbt_die("Could not launch a new process on failed host %s.", host->get_cname()); } + xbt_dict_free(&properties); for (int i = 0; i != argc; ++i) xbt_free(argv[i]); xbt_free(argv); diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index f31600a392..34ae162442 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -41,23 +41,25 @@ ActorPtr Actor::self() } ActorPtr Actor::init(std::string name, s4u::Host* host) { - return SIMIX_process_self()->init(std::move(name), host)->iface(); + smx_actor_t self = SIMIX_process_self(); + simgrid::kernel::actor::ActorImpl* actor = + simgrid::simix::simcall([self, name, host] { return self->init(std::move(name), host).get(); }); + intrusive_ptr_release(actor); + return actor->ciface(); } ActorPtr Actor::start(std::function code) { - simgrid::simix::simcall([this, code] { return this->get_impl()->start(code); }); + simgrid::simix::simcall([this, code] { pimpl_->start(code); }); return this; } ActorPtr Actor::create(std::string name, s4u::Host* host, std::function code) { - smx_actor_t self = SIMIX_process_self(); - simgrid::kernel::actor::ActorImpl* actor = - simgrid::simix::simcall([self, name, host, code] { return self->init(std::move(name), host)->start(code); }); + simcall_process_create(std::move(name), std::move(code), nullptr, host, nullptr); - return actor->ciface(); + return actor->iface(); } ActorPtr Actor::create(std::string name, s4u::Host* host, const std::string& function, std::vector args) diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index 4e0228729f..2e604a9e01 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -488,7 +488,11 @@ ActorImplPtr ActorImpl::create(std::string name, simix::ActorCode code, void* da { XBT_DEBUG("Start actor %s@'%s'", name.c_str(), host->get_cname()); - ActorImplPtr actor = SIMIX_process_self()->init(simgrid::xbt::string(name), host); + ActorImplPtr actor; + if (parent_actor != nullptr) + actor = parent_actor->init(simgrid::xbt::string(name), host); + else + actor = SIMIX_process_self()->init(simgrid::xbt::string(name), host); /* actor data */ actor->set_user_data(data); diff --git a/teshsuite/msg/cloud-migration/cloud-migration.tesh b/teshsuite/msg/cloud-migration/cloud-migration.tesh index d4812c6fd2..124b61a9c7 100644 --- a/teshsuite/msg/cloud-migration/cloud-migration.tesh +++ b/teshsuite/msg/cloud-migration/cloud-migration.tesh @@ -4,9 +4,9 @@ $ $SG_TEST_EXENV ${bindir:=.}/cloud-migration ${platfdir}/small_platform.xml --l > [132.765801] (1:master_@Fafard) Test: Migrate a VM with 100 Mbytes RAM > [146.111793] (1:master_@Fafard) VM0 migrated: Fafard->Tremblay in 13.346 s > [146.111793] (1:master_@Fafard) Test: Migrate two VMs at once from PM0 to PM1 -> [411.566271] (7:mig_wrk@Fafard) VM1 migrated: Fafard->Tremblay in 265.454 s +> [411.566271] (8:mig_wrk@Fafard) VM1 migrated: Fafard->Tremblay in 265.454 s > [411.566271] (6:mig_wrk@Fafard) VM0 migrated: Fafard->Tremblay in 265.454 s > [10146.111793] (1:master_@Fafard) Test: Migrate two VMs at once to different PMs -> [10362.620589] (13:mig_wrk@Fafard) VM1 migrated: Fafard->Bourassa in 216.509 s +> [10362.620589] (14:mig_wrk@Fafard) VM1 migrated: Fafard->Bourassa in 216.509 s > [10411.547334] (12:mig_wrk@Fafard) VM0 migrated: Fafard->Tremblay in 265.436 s > [20146.111793] (0:maestro@) Bye (simulation time 20146.1)