From 6fbb94e01784b72821e976e000fe6d82bedabb66 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 26 Mar 2024 08:02:49 +0200 Subject: Fix bug in default_ram_minimum value in bbot-agent --- bbot/agent/agent.cxx | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'bbot') diff --git a/bbot/agent/agent.cxx b/bbot/agent/agent.cxx index 5e7ba65..2de1d8b 100644 --- a/bbot/agent/agent.cxx +++ b/bbot/agent/agent.cxx @@ -60,7 +60,7 @@ using std::endl; // plausible like 256MiB. This way we won't end up with degenerate cases where // we attempt to start a machine with some absurd amount of RAM. // -const std::uint64_t default_ram_minimum = 252144; +const std::uint64_t default_ram_minimum = 262144; static inline std::uint64_t effective_ram_minimum (const machine_header_manifest& m) @@ -444,7 +444,7 @@ bootstrap_build_machine (const dir_path& md, // the machine directory and ignore the machine for now). // static vector -divide_auxiliary_ram (const vector&); +divide_auxiliary_ram (const vector&); static optional bootstrap_auxiliary_machine (const dir_path& md, @@ -1796,7 +1796,7 @@ catch (const system_error& e) // insufficient. // static vector // Parallel to mms. -divide_auxiliary_ram (const vector& mms) +divide_auxiliary_ram (const vector& mms) { size_t ram (ops.auxiliary_ram ()); @@ -1805,7 +1805,7 @@ divide_auxiliary_ram (const vector& mms) // First pass: allocate the minimums. // - for (const machine_manifest* mm: mms) + for (const machine_header_manifest* mm: mms) { size_t v (effective_ram_minimum (*mm)); @@ -1855,7 +1855,7 @@ divide_auxiliary_ram (const vector& mms) { if (rnds[i] != a) { - const machine_manifest& mm (*mms[i]); + const machine_header_manifest& mm (*mms[i]); size_t o (rams[i]); size_t v (effective_ram_minimum (mm)); @@ -1961,7 +1961,7 @@ start_auxiliary_machines (const vector& ams, // vector rams; { - vector mms; + vector mms; mms.reserve (n); for (bootstrapped_machine* am: ams) mms.push_back (&am->manifest.machine); @@ -2522,6 +2522,21 @@ try verb = ops.verbose (); +#if 0 + // ./bbot-agent --auxiliary-ram 4194304 + // + machine_header_manifest m1 { + "m1", "m1", "m1", machine_role::auxiliary, 512*1024, nullopt}; + machine_header_manifest m2 { + "m2", "m2", "m2", machine_role::auxiliary, 1024*1024, 3*512*1024}; + vector mms {&m1, &m2}; + vector rams (divide_auxiliary_ram (mms)); + for (size_t i (0); i != rams.size (); ++i) + text << mms[i]->name << ' ' << rams[i] / 1024; + + return 0; +#endif + // @@ systemd 231 added JOURNAL_STREAM environment variable which allows // detecting if stderr is connected to the journal. // -- cgit v1.1