[libvirt] [PATCH RFC 0/5] support cpu bandwidth in libvirt

Adam Litke agl at us.ibm.com
Thu Jun 16 13:48:17 UTC 2011



On 06/16/2011 12:44 AM, Wen Congyang wrote:
> In the kernel, the value of quota is stored in uint64_t:
> =======================================
> struct cfs_bandwidth {
> #ifdef CONFIG_CFS_BANDWIDTH
> 	raw_spinlock_t lock;
> 	ktime_t period;
> 	u64 quota;             <========== here is u64, not s64
> 	u64 runtime;
> 	u64 runtime_expires;
> 	s64 hierarchal_quota;
> 
> 	int idle;
> 	struct hrtimer period_timer, slack_timer;
> 	struct list_head throttled_cfs_rq;
> 
> 	/* statistics */
> 	int nr_periods, nr_throttled;
> 	u64 throttled_time;
> 
> #endif
> };
> =======================================
> 
> The unit of quota in kernel is ns, but the value we write to cpu.cfs_quota_us is us.
> So the max value we can write is 2^64/1000.
> 
> In the kernel, if quota is ~0ULL, it means unlimited.

Ok, I would think you can use the same semantics in libvirt then.  No
need for a structure.

-- 
Adam Litke
IBM Linux Technology Center




More information about the libvir-list mailing list