public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* Number of threads for virtual machine process
@ 2015-02-16 10:54 mad Engineer
  2015-02-16 15:51 ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: mad Engineer @ 2015-02-16 10:54 UTC (permalink / raw)
  To: kvm

Hello all,
             On a RHEL 6.4 server i created a vm with 2 VCPU and
expecting to see single process with 2 threads on host.
but
      top -p "pid-of-qemu" -H

  shows many threads randomly being created and
destroyed,"pid-of-qemu" remains the same but other threads' pid keep
on changing.

Can some one help me understand this better.I was in a belief that
virtual machine with 2 VCPU will have 2 threads,but sometimes total
thread count has reached upto 8.

top output from host when running multiple "dd"

11116 qemu      20   0 2480m 381m 4664 R 100.2  3.9   1:57.97
/usr/libexec/qemu-kvm -name HAP -S -M rhel6.1.0 -enable-kvm -m 2048
-smp 2,sockets=2,cores=1,threads=1 -uuid 2b8c1cd4-2de7-e59
11117 qemu      20   0 2480m 381m 4664 R 99.6  3.9   0:34.97
/usr/libexec/qemu-kvm -name HAP -S -M rhel6.1.0 -enable-kvm -m 2048
-smp 2,sockets=2,cores=1,threads=1 -uuid 2b8c1cd4-2de7-e594
11101 qemu      20   0 2480m 381m 4664 S  0.0  3.9   0:13.33
/usr/libexec/qemu-kvm -name HAP -S -M rhel6.1.0 -enable-kvm -m 2048
-smp 2,sockets=2,cores=1,threads=1 -uuid 2b8c1cd4-2de7-e594
31278 qemu      20   0 2480m 381m 4664 S  0.0  3.9   0:00.00
/usr/libexec/qemu-kvm -name HAP -S -M rhel6.1.0 -enable-kvm -m 2048
-smp 2,sockets=2,cores=1,threads=1 -uuid 2b8c1cd4-2de7-e594


HT is ON on host.

Even Though total CPU consumed by first two threads are 200%,i don't
understand why there are these many extra threads

Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Number of threads for virtual machine process
  2015-02-16 10:54 Number of threads for virtual machine process mad Engineer
@ 2015-02-16 15:51 ` Paolo Bonzini
  2015-02-17  4:44   ` mad Engineer
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2015-02-16 15:51 UTC (permalink / raw)
  To: mad Engineer, kvm



On 16/02/2015 11:54, mad Engineer wrote:
> Hello all,
>              On a RHEL 6.4 server i created a vm with 2 VCPU and
> expecting to see single process with 2 threads on host.
> but
>       top -p "pid-of-qemu" -H
> 
>   shows many threads randomly being created and
> destroyed,"pid-of-qemu" remains the same but other threads' pid keep
> on changing.

The "extra" threads are doing I/O.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Number of threads for virtual machine process
  2015-02-16 15:51 ` Paolo Bonzini
@ 2015-02-17  4:44   ` mad Engineer
  2015-02-17  6:51     ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: mad Engineer @ 2015-02-17  4:44 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm

Thanks for the response.
           Can a vm process create any number of extra threads based
on i/o requirement ,or is there any relation between number of VCPU
allowed and these extra threads.

I hope these threads are for disk i/o and for network it uses
vhost-'pid' process.


Thanks for your help


On Mon, Feb 16, 2015 at 9:21 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 16/02/2015 11:54, mad Engineer wrote:
>> Hello all,
>>              On a RHEL 6.4 server i created a vm with 2 VCPU and
>> expecting to see single process with 2 threads on host.
>> but
>>       top -p "pid-of-qemu" -H
>>
>>   shows many threads randomly being created and
>> destroyed,"pid-of-qemu" remains the same but other threads' pid keep
>> on changing.
>
> The "extra" threads are doing I/O.
>
> Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Number of threads for virtual machine process
  2015-02-17  4:44   ` mad Engineer
@ 2015-02-17  6:51     ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2015-02-17  6:51 UTC (permalink / raw)
  To: mad Engineer; +Cc: kvm



On 17/02/2015 05:44, mad Engineer wrote:
> Thanks for the response.
>            Can a vm process create any number of extra threads based
> on i/o requirement ,or is there any relation between number of VCPU
> allowed and these extra threads.

No, there is not relation.  The I/O threads are created by QEMU, which
is a userspace program that uses KVM.  Different implementations could
do I/O in a different way.  Alternatively, QEMU itself can use the Linux
AIO API.  In that case it still creates threads to do fdatasync, but not
to do read/write.

> I hope these threads are for disk i/o and for network it uses
> vhost-'pid' process.

For network it can use vhost or do everything into the main thread of QEMU.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-17  6:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-16 10:54 Number of threads for virtual machine process mad Engineer
2015-02-16 15:51 ` Paolo Bonzini
2015-02-17  4:44   ` mad Engineer
2015-02-17  6:51     ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox