提交 e7b91c51 编写于 作者: P Peter Krempa

qemu: domain: Restructurate control flow in qemuDomainGetMlockLimitBytes

Break early when hard limit is set so that it's not intermixed by other
logic for determining the limit.
上级 53ec39ea
......@@ -3639,14 +3639,18 @@ qemuDomainGetMlockLimitBytes(virDomainDefPtr def)
{
unsigned long long memKB;
/* prefer the hard limit */
if (virMemoryLimitIsSet(def->mem.hard_limit)) {
memKB = def->mem.hard_limit;
goto done;
}
/* VFIO requires all of the guest's memory to be locked resident, plus some
* amount for IO space. Alex Williamson suggested adding 1GiB for IO space
* just to be safe (some finer tuning might be nice, though). */
if (virMemoryLimitIsSet(def->mem.hard_limit))
memKB = def->mem.hard_limit;
else
memKB = virDomainDefGetMemoryActual(def) + 1024 * 1024;
memKB = virDomainDefGetMemoryActual(def) + 1024 * 1024;
done:
return memKB << 10;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册