-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qmemman: handle memory assigned to VM but not yet used
When VM got some memory assigned, balloon driver may not pick it up immediatelly and the memory will still be seen as "free" by Xen, but VM can use (request) it at any time. Qmemman needs to take care of such memory (exclude it from "free" pool), otherwise it would redistribute it to other domains, allowing the original domain to drain Xen memory pool. Do this by redefining DomainState.memory_actual - it is now amount of memory available to the VM (currently used, or possibly used). Then calculate free memory by subtracting memory allocated but not used (memory_target-memory_current). Fixes QubesOS/qubes-issues#1389
- Loading branch information
Showing
2 changed files
with
36 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,6 +157,14 @@ def handle(self): | |
self.log.debug('data={!r}'.format(self.data)) | ||
if len(self.data) == 0: | ||
self.log.info('EOF') | ||
# FIXME: there is a race condition here: if XS_Watcher will | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
marmarek
Author
Owner
|
||
# handle meminfo event before @introduceDomain, it will use | ||
# incomplete domain list for that and may redistribute memory | ||
# allocated to some VM, but not yet used (see #1389). | ||
# To fix that, system_state should be updated (refresh domain | ||
# list) before releasing the lock, but in the current code | ||
# layout XS_Watcher instance isn't available here, | ||
# so xenstore watches would not be registered | ||
if got_lock: | ||
global_lock.release() | ||
self.log.debug('global_lock released') | ||
|
maybe have xs watcher use a tombstone value set at VM startup to do redistribution?
redistribution always sucks in these ways, and I mean beyond the engineering ways.