def is_balance_req_significant(self, memset_reqs, xenfree): self.log.debug( 'is_balance_req_significant(memset_reqs={}, xenfree={})'.format( memset_reqs, xenfree)) total_memory_transfer = 0 MIN_TOTAL_MEMORY_TRANSFER = 150 * 1024 * 1024 MIN_MEM_CHANGE_WHEN_UNDER_PREF = 15 * 1024 * 1024 # If xenfree to low, return immediately if self.XEN_FREE_MEM_LEFT - xenfree > MIN_MEM_CHANGE_WHEN_UNDER_PREF: self.log.debug('xenfree is too low, returning') return True for rq in memset_reqs: dom, mem = rq last_target = self.domdict[dom].last_target memory_change = mem - last_target total_memory_transfer += abs(memory_change) pref = qmemman_algo.prefmem(self.domdict[dom]) if last_target > 0 and last_target < pref and memory_change > MIN_MEM_CHANGE_WHEN_UNDER_PREF: self.log.info( 'dom {} is below pref, allowing balance'.format(dom)) return True ret = total_memory_transfer + abs( xenfree - self.XEN_FREE_MEM_LEFT) > MIN_TOTAL_MEMORY_TRANSFER self.log.debug('is_balance_req_significant return {}'.format(ret)) return ret
def is_balance_req_significant(self, memset_reqs, xenfree): self.log.debug( 'is_balance_req_significant(memset_reqs={}, xenfree={})'.format( memset_reqs, xenfree)) total_memory_transfer = 0 MIN_TOTAL_MEMORY_TRANSFER = 150*1024*1024 MIN_MEM_CHANGE_WHEN_UNDER_PREF = 15*1024*1024 # If xenfree to low, return immediately if self.XEN_FREE_MEM_LEFT - xenfree > MIN_MEM_CHANGE_WHEN_UNDER_PREF: self.log.debug('xenfree is too low, returning') return True for rq in memset_reqs: dom, mem = rq last_target = self.domdict[dom].last_target memory_change = mem - last_target total_memory_transfer += abs(memory_change) pref = qmemman_algo.prefmem(self.domdict[dom]) if last_target > 0 and last_target < pref and memory_change > MIN_MEM_CHANGE_WHEN_UNDER_PREF: self.log.info( 'dom {} is below pref, allowing balance'.format(dom)) return True ret = total_memory_transfer + abs(xenfree - self.XEN_FREE_MEM_LEFT) > MIN_TOTAL_MEMORY_TRANSFER self.log.debug('is_balance_req_significant return {}'.format(ret)) return ret
def print_stats(self, xenfree, memset_reqs): for i in self.domdict.keys(): if self.domdict[i].meminfo is not None: self.log.info('stat: dom {!r} act={} pref={}'.format(i, self.domdict[i].memory_actual, qmemman_algo.prefmem(self.domdict[i]))) self.log.info('stat: xenfree={} memset_reqs={}'.format(xenfree, memset_reqs))
def print_stats(self, xenfree, memset_reqs): for i in self.domdict.keys(): if self.domdict[i].meminfo is not None: self.log.info('stat: dom {!r} act={} pref={}'.format( i, self.domdict[i].memory_actual, qmemman_algo.prefmem(self.domdict[i]))) self.log.info('stat: xenfree={} memset_reqs={}'.format( xenfree, memset_reqs))
def is_balance_req_significant(self, memset_reqs, xenfree): total_memory_transfer = 0 MIN_TOTAL_MEMORY_TRANSFER = 150*1024*1024 MIN_MEM_CHANGE_WHEN_UNDER_PREF = 15*1024*1024 # If xenfree to low, return immediately if self.XEN_FREE_MEM_LEFT - xenfree > MIN_MEM_CHANGE_WHEN_UNDER_PREF: return True for rq in memset_reqs: dom, mem = rq last_target = self.domdict[dom].last_target memory_change = mem - last_target total_memory_transfer += abs(memory_change) pref = qmemman_algo.prefmem(self.domdict[dom]) if last_target > 0 and last_target < pref and memory_change > MIN_MEM_CHANGE_WHEN_UNDER_PREF: print 'dom', dom, 'is below pref, allowing balance' return True return total_memory_transfer + abs(xenfree - self.XEN_FREE_MEM_LEFT) > MIN_TOTAL_MEMORY_TRANSFER
def is_balance_req_significant(self, memset_reqs, xenfree): total_memory_transfer = 0 MIN_TOTAL_MEMORY_TRANSFER = 150 * 1024 * 1024 MIN_MEM_CHANGE_WHEN_UNDER_PREF = 15 * 1024 * 1024 # If xenfree to low, return immediately if self.XEN_FREE_MEM_LEFT - xenfree > MIN_MEM_CHANGE_WHEN_UNDER_PREF: return True for rq in memset_reqs: dom, mem = rq last_target = self.domdict[dom].last_target memory_change = mem - last_target total_memory_transfer += abs(memory_change) pref = qmemman_algo.prefmem(self.domdict[dom]) if last_target > 0 and last_target < pref and memory_change > MIN_MEM_CHANGE_WHEN_UNDER_PREF: print 'dom', dom, 'is below pref, allowing balance' return True return total_memory_transfer + abs( xenfree - self.XEN_FREE_MEM_LEFT) > MIN_TOTAL_MEMORY_TRANSFER
def print_stats(self, xenfree, memset_reqs): for i in self.domdict.keys(): if self.domdict[i].meminfo is not None: print 'dom' , i, 'act/pref', self.domdict[i].memory_actual, qmemman_algo.prefmem(self.domdict[i]) print 'xenfree=', xenfree, 'balance req:', memset_reqs
def print_stats(self, xenfree, memset_reqs): for i in self.domdict.keys(): if self.domdict[i].meminfo is not None: print 'dom', i, 'act/pref', self.domdict[ i].memory_actual, qmemman_algo.prefmem(self.domdict[i]) print 'xenfree=', xenfree, 'balance req:', memset_reqs