qmemman: clear "not responding" flags when VM require more memory

Clear slow_memset_react/no_progress flags when VM request more memory
than it have assigned. If there is some available, it may be given to
such VM, solving the original problem (not reacting to balloon down
request). In any case, qmemman algorithm should not try to take away
memory from under-provisioned VM.

Fixes QubesOS/qubes-issues#3265
This commit is contained in:
Marek Marczykowski-Górecki 2018-01-11 02:15:15 +01:00
parent 4cf6a93b5b
commit bf4306b815
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -140,14 +140,16 @@ class SystemState(object):
def clear_outdated_error_markers(self):
# Clear outdated errors
for i in self.domdict.keys():
if self.domdict[i].slow_memset_react and \
self.domdict[i].memory_actual <= \
self.domdict[i].last_target + self.XEN_FREE_MEM_LEFT/4:
# clear markers excluding VM from memory balance, if:
# - VM have responded to previous request (with some safety margin)
# - VM request more memory than it has assigned
# The second condition avoids starving a VM, even when there is
# some free memory available
if self.domdict[i].memory_actual <= \
self.domdict[i].last_target + self.XEN_FREE_MEM_LEFT/2 or \
self.domdict[i].memory_actual < \
qubes.qmemman.algo.prefmem(self.domdict[i]):
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:
self.domdict[i].no_progress = False
# the below works (and is fast), but then 'xm list' shows unchanged