コード例 #1
0
    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
コード例 #2
0
ファイル: qmemman.py プロジェクト: ptitdoc/qubes-core-admin
    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
コード例 #3
0
ファイル: qmemman.py プロジェクト: ptitdoc/qubes-core-admin
    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))
コード例 #4
0
    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))
コード例 #5
0
ファイル: qmemman.py プロジェクト: AndrewX192/qubes-core
 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
コード例 #6
0
 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
コード例 #7
0
ファイル: qmemman.py プロジェクト: AndrewX192/qubes-core
 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
コード例 #8
0
 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