Hi, I have some questions on scheduling. 1. Suppose I give a VM 2 vcpus. When this VM gets scheduled will it always be given two pcpus or can it be given 1vcpu also sometimes. For example if we have mutiple VMs running, and if a cpu gets freed up will my 2vcpu VM be scheduled on this single free cpu. If a single cpu cna be given how is the cpu % calculated by xentop 2. If the 2vcpu is scheduled on two cpus, and one of its threads goes to sleep can that single thread be context swtiched out. or will it be kept spinning. 3. When xentop reports VM cpu% as say 167% what does that mean. is it the % of time for the 2 vcpus (that means the VM is using 167% of the 200% it was allotted, or is the 167% of the number of pcpus in the system), or is it 167% of the total number of vcpus. Thanks much for answering my questions - Prabha _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Hi, xentop gets information from runstate (see vcpu_runstate_change()) Please check it. Thanks Atsushi SAKAI pak333@comcast.net wrote:> Hi, > > I have some questions on scheduling. > > 1. Suppose I give a VM 2 vcpus. When this VM gets scheduled will it always be given two pcpus or can it be given 1vcpu also sometimes. For example if we have mutiple VMs running, and if a cpu gets freed up will my 2vcpu VM be scheduled on this single free cpu. If a single cpu cna be given how is the cpu % calculated by xentop > > 2. If the 2vcpu is scheduled on two cpus, and one of its threads goes to sleep can that single thread be context swtiched out. or will it be kept spinning. > > 3. When xentop reports VM cpu% as say 167% what does that mean. is it the % of time for the 2 vcpus (that means the VM is using 167% of the 200% it was allotted, or is the 167% of the number of pcpus in the system), or is it 167% of the total number of vcpus. > > Thanks much for answering my questions > > - Prabha_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 20/03/07 01:37 +0000, pak333@comcast.net wrote:> > 1. Suppose I give a VM 2 vcpus. When this VM gets scheduled will it > always be given two pcpus or can it be given 1vcpu also sometimes. > For example if we have mutiple VMs running, and if a cpu gets freed up > will my 2vcpu VM be scheduled on this single free cpu. If a single > cpu cna be given how is the cpu % calculated by xentopIt depends on how busy the CPUs are on the machine, and the ratio of VCPU to PCPU. When the VM has two VCPUs, each VCPU (when runnable) will be put on the run queue of a physical CPU. This VM will run concurrently on AT MOST 2 PCPUs, sometimes only 1 PCPU. If on the platform VCPU == PCPU in aggregate then the VM with 2 VCPUs will frequently run concurrently on two PCPUs.> > 2. If the 2vcpu is scheduled on two cpus, and one of its threads goes > to sleep can that single thread be context swtiched out. or will it be > kept spinning.VM''s get scheduled as VCPUs, not threads. Having two VCPU''s for a VM is sort of like a process having two threads. But there are a lot of differences as well so don''t take the analogy too far. When a VCPU for a VM is not running it is not executing any code. The VCPU can be runnable, running, or sleeping. It only executes code when it is running. However, remember that *kernel threads* are scheduled by the guest kernel, while the guest kernel is scheduled as one or more VCPUs by *xen.* The guest kernel is allowed to put its own threads to sleep and awaken other threads, but when Xen decides that the time slice is over for a VCPU, then that VCPU gets rescheduled at the back of the q, or put to sleep. I don''t know very much about xentop. Mike -- Mike D. Day IBM LTC Cell: 919 412-3900 Sametime: ncmike@us.ibm.com AIM: ncmikeday Yahoo: ultra.runner PGP key: http://www.ncultra.org/ncmike/pubkey.asc _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Thanks for the explanation. I still have questions about how cpu utilization is reported by xm top/xentop. If someone can answer the question as to how the cpu% is calculated, when a VM with 2 vcpus, is only using 1 pcpu at any given point of time. Also, a vcpu is given the full pcpu. What if it doesn''t use the full pcpu. How is it scheduled? thanks Prabha -------------- Original message -------------- From: "Mike D. Day" <ncmike@us.ibm.com>> On 20/03/07 01:37 +0000, pak333@comcast.net wrote: > > > > 1. Suppose I give a VM 2 vcpus. When this VM gets scheduled will it > > always be given two pcpus or can it be given 1vcpu also sometimes. > > For example if we have mutiple VMs running, and if a cpu gets freed up > > will my 2vcpu VM be scheduled on this single free cpu. If a single > > cpu cna be given how is the cpu % calculated by xentop > > It depends on how busy the CPUs are on the machine, and the ratio of > VCPU to PCPU. > > When the VM has two VCPUs, each VCPU (when runnable) will be put on > the run queue of a physical CPU. This VM will run concurrently on AT > MOST 2 PCPUs, sometimes only 1 PCPU. If on the platform VCPU == PCPU > in aggregate then the VM with 2 VCPUs will frequently run concurrently > on two PCPUs. > > > > > > 2. If the 2vcpu is scheduled on two cpus, and one of its threads goes > > to sleep can that single thread be context swtiched out. or will it be > > kept spinning. > > VM''s get scheduled as VCPUs, not threads. Having two VCPU''s for a VM > is sort of like a process having two threads. But there are a lot of > differences as well so don''t take the analogy too far. > > When a VCPU for a VM is not running it is not executing any code. The > VCPU can be runnable, running, or sleeping. It only executes code when > it is running. > > However, remember that *kernel threads* are scheduled by the guest kernel, > while the guest kernel is scheduled as one or more VCPUs by *xen.* The > guest kernel is allowed to put its own threads to sleep and awaken > other threads, but when Xen decides that the time slice is over for a > VCPU, then that VCPU gets rescheduled at the back of the q, or put to > sleep. > > I don''t know very much about xentop. > > Mike > > -- > Mike D. Day > IBM LTC > Cell: 919 412-3900 > Sametime: ncmike@us.ibm.com AIM: ncmikeday Yahoo: ultra.runner > PGP key: http://www.ncultra.org/ncmike/pubkey.asc > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel