qmemman: slightly improve logging

Add logging more info about each domain state:
 - last requested target
 - no_progress and slow_memset_react flags

This makes it unnecessary to log separately when those flags are cleared.
This commit is contained in:
Marek Marczykowski-Górecki 2018-01-07 17:09:06 +01:00
parent 8e288d9f81
commit 4cf6a93b5b
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 9 additions and 22 deletions

View File

@ -143,19 +143,11 @@ class SystemState(object):
if self.domdict[i].slow_memset_react and \
self.domdict[i].memory_actual <= \
self.domdict[i].last_target + self.XEN_FREE_MEM_LEFT/4:
dom_name = self.xs.read('', '/local/domain/%s/name' % str(i))
if dom_name is not None:
# TODO: report it somewhere, qubesd or elsewhere
pass
self.domdict[i].slow_memset_react = False
if self.domdict[i].no_progress and \
self.domdict[i].memory_actual <= \
self.domdict[i].last_target + self.XEN_FREE_MEM_LEFT/4:
dom_name = self.xs.read('', '/local/domain/%s/name' % str(i))
if dom_name is not None:
# TODO: report it somewhere, qubesd or elsewhere
pass
self.domdict[i].no_progress = False
# the below works (and is fast), but then 'xm list' shows unchanged
@ -285,9 +277,14 @@ class SystemState(object):
def print_stats(self, xenfree, memset_reqs):
for i in self.domdict.keys():
if self.domdict[i].mem_used is not None:
self.log.info('stat: dom {!r} act={} pref={}'.format(i,
self.domdict[i].memory_actual,
qubes.qmemman.algo.prefmem(self.domdict[i])))
self.log.info('stat: dom {!r} act={} pref={} last_target={}'
'{}{}'.format(i,
self.domdict[i].memory_actual,
qubes.qmemman.algo.prefmem(self.domdict[i]),
self.domdict[i].last_target,
' no_progress' if self.domdict[i].no_progress else '',
' slow_memset_react'
if self.domdict[i].slow_memset_react else ''))
self.log.info('stat: xenfree={} memset_reqs={}'.format(xenfree, memset_reqs))
@ -343,11 +340,6 @@ class SystemState(object):
self.domdict[dom2].memory_actual,
mem2))
self.domdict[dom2].no_progress = True
dom_name = self.xs.read('', '/local/domain/%s/name' % str(dom2))
if dom_name is not None:
# TODO: report it somewhere, qubesd or
# elsewhere
pass
else:
self.log.warning('dom {!r} still hold more'
' memory than have assigned ({} > {})'
@ -355,11 +347,6 @@ class SystemState(object):
self.domdict[dom2].memory_actual,
mem2))
self.domdict[dom2].slow_memset_react = True
dom_name = self.xs.read('', '/local/domain/%s/name' % str(dom2))
if dom_name is not None:
# TODO: report it somewhere, qubesd or
# elsewhere
pass
self.mem_set(dom, self.get_free_xen_memory() + self.domdict[dom].memory_actual - self.XEN_FREE_MEM_LEFT)
return

View File

@ -239,7 +239,7 @@ def balance_when_enough_memory(domain_dictionary,
# prefmem, and redistribute anything left between acceptors
def balance_when_low_on_memory(domain_dictionary,
xen_free_memory, total_mem_pref_acceptors, donors, acceptors):
log.debug('balance_when_low_on_memory(xen_free_memory={!r}, '
log.info('balance_when_low_on_memory(xen_free_memory={!r}, '
'total_mem_pref_acceptors={!r}, donors={!r}, acceptors={!r})'.format(
xen_free_memory, total_mem_pref_acceptors, donors, acceptors))
donors_rq = list()