Support large VMs by removing the fixed balloon iteration limit
This commit is contained in:
parent
4f04c62f36
commit
a55172d63e
@ -136,21 +136,31 @@ class SystemState(object):
|
|||||||
#perform memory ballooning, across all domains, to add "memsize" to Xen free memory
|
#perform memory ballooning, across all domains, to add "memsize" to Xen free memory
|
||||||
def do_balloon(self, memsize):
|
def do_balloon(self, memsize):
|
||||||
self.log.info('do_balloon(memsize={!r})'.format(memsize))
|
self.log.info('do_balloon(memsize={!r})'.format(memsize))
|
||||||
MAX_TRIES = 20
|
CHECK_PERIOD_S = 3
|
||||||
|
CHECK_MB_S = 100
|
||||||
|
|
||||||
niter = 0
|
niter = 0
|
||||||
prev_memory_actual = None
|
prev_memory_actual = None
|
||||||
|
|
||||||
for i in self.domdict.keys():
|
for i in self.domdict.keys():
|
||||||
self.domdict[i].no_progress = False
|
self.domdict[i].no_progress = False
|
||||||
|
|
||||||
|
check_period = max(1, int((CHECK_PERIOD_S + 0.0) / self.BALOON_DELAY))
|
||||||
|
check_delta = CHECK_PERIOD_S * CHECK_MB_S * 1024 * 1024
|
||||||
|
xenfree_ring = [0] * check_period
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
self.log.debug('niter={:2d}/{:2d}'.format(niter, MAX_TRIES))
|
self.log.debug('niter={:2d}'.format(niter))
|
||||||
self.refresh_memactual()
|
self.refresh_memactual()
|
||||||
xenfree = self.get_free_xen_memory()
|
xenfree = self.get_free_xen_memory()
|
||||||
self.log.info('xenfree={!r}'.format(xenfree))
|
self.log.info('xenfree={!r}'.format(xenfree))
|
||||||
if xenfree >= memsize + self.XEN_FREE_MEM_MIN:
|
if xenfree >= memsize + self.XEN_FREE_MEM_MIN:
|
||||||
self.inhibit_balloon_up()
|
self.inhibit_balloon_up()
|
||||||
return True
|
return True
|
||||||
|
ring_slot = niter % check_period
|
||||||
|
if niter >= check_period and xenfree < xenfree_ring[ring_slot] + check_delta:
|
||||||
|
return False
|
||||||
|
xenfree_ring[ring_slot] = xenfree
|
||||||
if prev_memory_actual is not None:
|
if prev_memory_actual is not None:
|
||||||
for i in prev_memory_actual.keys():
|
for i in prev_memory_actual.keys():
|
||||||
if prev_memory_actual[i] == self.domdict[i].memory_actual:
|
if prev_memory_actual[i] == self.domdict[i].memory_actual:
|
||||||
@ -159,7 +169,7 @@ class SystemState(object):
|
|||||||
self.log.info('domain {} stuck at {}'.format(i, self.domdict[i].memory_actual))
|
self.log.info('domain {} stuck at {}'.format(i, self.domdict[i].memory_actual))
|
||||||
memset_reqs = qmemman_algo.balloon(memsize + self.XEN_FREE_MEM_LEFT - xenfree, self.domdict)
|
memset_reqs = qmemman_algo.balloon(memsize + self.XEN_FREE_MEM_LEFT - xenfree, self.domdict)
|
||||||
self.log.info('memset_reqs={!r}'.format(memset_reqs))
|
self.log.info('memset_reqs={!r}'.format(memset_reqs))
|
||||||
if niter > MAX_TRIES or len(memset_reqs) == 0:
|
if len(memset_reqs) == 0:
|
||||||
return False
|
return False
|
||||||
prev_memory_actual = {}
|
prev_memory_actual = {}
|
||||||
for i in memset_reqs:
|
for i in memset_reqs:
|
||||||
|
Loading…
Reference in New Issue
Block a user