From: Martin Quinson Date: Thu, 15 Jun 2017 15:36:21 +0000 (+0200) Subject: try to fix the impact of a big full VM on its PM X-Git-Tag: v3.16~84 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/864618094efa422a18a6e4837b234f5b5a940652 try to fix the impact of a big full VM on its PM --- diff --git a/src/plugins/vm/VirtualMachineImpl.hpp b/src/plugins/vm/VirtualMachineImpl.hpp index d9371762d4..39487a8e60 100644 --- a/src/plugins/vm/VirtualMachineImpl.hpp +++ b/src/plugins/vm/VirtualMachineImpl.hpp @@ -95,6 +95,7 @@ public: e_surf_vm_state_t getState(); void setState(e_surf_vm_state_t state); static std::deque allVms_; + int coreAmount() { return coreAmount_; } bool isMigrating = false; diff --git a/src/surf/HostImpl.cpp b/src/surf/HostImpl.cpp index 72f0f72f68..b212a1692f 100644 --- a/src/surf/HostImpl.cpp +++ b/src/surf/HostImpl.cpp @@ -29,24 +29,14 @@ void HostModel::ignoreEmptyVmInPmLMM() { /* iterate for all virtual machines */ for (s4u::VirtualMachine* ws_vm : vm::VirtualMachineImpl::allVms_) { - Cpu* cpu = ws_vm->pimpl_cpu; + int active_tasks = lmm_constraint_get_variable_amount(cpu->constraint()); - int is_active = lmm_constraint_used(cpu->model()->getMaxminSystem(), cpu->constraint()); - - if (is_active) { - /* some tasks exist on this VM */ - XBT_DEBUG("set the weight of the dummy CPU action on PM to 1"); - - /* FIXME: If we assign 1.05 and 0.05, the system makes apparently wrong values. */ - ws_vm->pimpl_vm_->action_->setPriority(1); + /* The impact of the VM over its PM is the min between its vCPU amount and the amount of tasks it contains */ + int impact = std::min(active_tasks, ws_vm->pimpl_vm_->coreAmount()); - } else { - /* no task exist on this VM */ - XBT_DEBUG("set the weight of the dummy CPU action on PM to 0"); - - ws_vm->pimpl_vm_->action_->setPriority(0); - } + XBT_INFO("set the weight of the dummy CPU action of VM%p on PM to %d (#tasks: %d)", ws_vm, impact, active_tasks); + ws_vm->pimpl_vm_->action_->setPriority(impact); } }