[libvirt] [PATCH RFC 0/5] support cpu bandwidth in libvirt
Adam Litke
agl at us.ibm.com
Wed Jun 15 19:47:43 UTC 2011
On 06/15/2011 01:24 AM, Wen Congyang wrote:
> I need this feature immediately after CFS bandwidth patchset is merged into
> upstream kernel. So I prepare this patchset, and post it here for reviewing
> before CFS bandwidth is merged into upstream kernel.
>
> quota is an optional attribute specified in microseconds not a percentage of period.
>
> TODO:
> 1. quota should be in the range [1000, 18446744073709551(2^64/1000)] or less than 0.
> But I only limit it less or equal than 2^64/1000. Does anyone have a better
> way to limit quota?
What are the semantics of quota < 0, of quota == 0? How are you storing
such a large signed integer in the kernel? I will guess that any value
less than 0 means: no limit, and 0 means: no quota (ie. the cgroup
cannot run on the cpu).
I am not sure what the libvirt convention for dealing with a situation
like this is. I think you have two options: 1) override an invalid
value (ie. 1) to represent the case (n < 0) or, 2) use a struct to
represent the quota:
struct _virCfsQuota {
unsigned long long val;
int unlimited;
};
When the quota is unlimited, .unlimited == 1 and val is undefined.
Otherwise, the quota is in val.
>
> Wen Congyang (5):
> cgroup: Implement cpu.cfs_period_us and cpu.cfs_quota_us tuning API
> Update XML Schema for new entries
> qemu: Implement period and quota tunable XML configuration and
> parsing.
> qemu: Implement cfs_period and cfs_quota's modification
> doc: Add documentation for new cputune elements period and quota
>
> docs/formatdomain.html.in | 19 +++
> docs/schemas/domain.rng | 25 ++++-
> src/conf/domain_conf.c | 20 +++-
> src/conf/domain_conf.h | 2 +
> src/libvirt_private.syms | 4 +
> src/qemu/qemu_cgroup.c | 43 +++++-
> src/qemu/qemu_driver.c | 162 +++++++++++++++++++----
> src/util/cgroup.c | 81 +++++++++++-
> src/util/cgroup.h | 6 +
> tests/qemuxml2argvdata/qemuxml2argv-cputune.xml | 2 +
> 10 files changed, 328 insertions(+), 36 deletions(-)
--
Adam Litke
IBM Linux Technology Center
More information about the libvir-list
mailing list