From 6ab259d642608b71d749f98d66aca79fc02fa426 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 7 Jun 2018 11:59:37 +0200 Subject: [PATCH] init: update state report on new/killed children This patch reduces the latency of state reports when children are removed or added, thereby, accellerating the feedback loop between a management component and init during the staged startup or removal of inter-dependent components. --- repos/os/src/init/main.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/repos/os/src/init/main.cc b/repos/os/src/init/main.cc index 88a58defce..5b4a142a0c 100644 --- a/repos/os/src/init/main.cc +++ b/repos/os/src/init/main.cc @@ -296,6 +296,8 @@ void Init::Main::_update_children_config() void Init::Main::_handle_config() { + bool update_state_report = false; + _config.update(); _config_xml = _config.xml(); @@ -331,6 +333,7 @@ void Init::Main::_handle_config() /* make the child's services unavailable */ child.destroy_services(); child.close_all_sessions(); + update_state_report = true; /* destroy child once all environment sessions are gone */ if (child.env_sessions_closed()) { @@ -384,6 +387,8 @@ void Init::Main::_handle_config() _parent_services, _child_services); _children.insert(&child); + update_state_report = true; + /* account for the start XML node buffered in the child */ size_t const metadata_overhead = start_node.size() + sizeof(Init::Child); @@ -445,6 +450,9 @@ void Init::Main::_handle_config() _children.for_each_child([&] (Child &child) { child.apply_upgrade(); }); _server.apply_config(_config_xml); + + if (update_state_report) + _state_reporter.trigger_immediate_report_update(); }