mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
qemu: Drop qemuDomainMemoryLimit
This function is to guess the correct limit for maximal memory usage by qemu for given domain. This can never be guessed correctly, not to mention all the pains and sleepless nights this code has caused. Once somebody discovers algorithm to solve the Halting Problem, we can compute the limit algorithmically. But till then, this code should never see the light of the release again. (cherry picked from commit 16bcb3b61675a88bff00317336b9610080c31000) Conflicts: src/qemu/qemu_cgroup.c src/qemu/qemu_command.c src/qemu/qemu_domain.c src/qemu/qemu_domain.h src/qemu/qemu_hotplug.c
This commit is contained in:
parent
03ba101aa2
commit
9421fd0010
@ -618,24 +618,7 @@ int qemuSetupCgroup(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_MEMORY)) {
|
||||
unsigned long long hard_limit = vm->def->mem.hard_limit;
|
||||
|
||||
if (!hard_limit) {
|
||||
/* If there is no hard_limit set, set a reasonable one to avoid
|
||||
* system thrashing caused by exploited qemu. A 'reasonable
|
||||
* limit' has been chosen:
|
||||
* (1 + k) * (domain memory + total video memory) + (32MB for
|
||||
* cache per each disk) + F
|
||||
* where k = 0.5 and F = 200MB. The cache for disks is important as
|
||||
* kernel cache on the host side counts into the RSS limit. */
|
||||
hard_limit = vm->def->mem.max_balloon;
|
||||
for (i = 0; i < vm->def->nvideos; i++)
|
||||
hard_limit += vm->def->videos[i]->vram;
|
||||
hard_limit = hard_limit * 1.5 + 204800;
|
||||
hard_limit += vm->def->ndisks * 32768;
|
||||
}
|
||||
|
||||
rc = virCgroupSetMemoryHardLimit(priv->cgroup, hard_limit);
|
||||
rc = virCgroupSetMemoryHardLimit(priv->cgroup, vm->def->mem.hard_limit);
|
||||
if (rc != 0) {
|
||||
virReportSystemError(-rc,
|
||||
_("Unable to set memory hard limit for domain %s"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user