kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dor Laor <dlaor@redhat.com>
To: "Yu Jiang (yujia)" <yujia@cisco.com>
Cc: kvm@vger.kernel.org
Subject: Re: Limit the CPU usage of KVM
Date: Mon, 17 Aug 2009 10:25:18 +0300	[thread overview]
Message-ID: <4A8905DE.7020000@redhat.com> (raw)
In-Reply-To: <797E8D15ABC7AC4DADF6DE8A5F7CD9B4063EBDE4@xmb-hkg-416.apac.cisco.com>

On 08/17/2009 08:09 AM, Yu Jiang (yujia) wrote:
> Hi KVM experts,
>
> Our user case needs to run KVM and application on host together. To
> reserve some CPU resource for application, we want to limit the CPU
> usage of KVM. Without KVM CPU usage limitation, the idle CPU of host OS
> becomes 0% in peak time.
>
> I have searched this topic on internet, but didn't find much comments.
>
> One possible solution could be managing KVM process as regular process
> on host OS, and use tool like http://cpulimit.sourceforge.net/ to limit
> maximum CPU usage of VM. Basically, the cpulimit tool use SIGSTP and
> SIGCONT signals to stop and resume the execution of KVM process. It
> works fine for us at moment. But, I feel there may be some risk to do
> this, because the signal will cause whole process of KVM paused(not only
> vcpu thread). Do you think it's safe to use cpulimit kinds of tool to
> SIGSTP/SIGCONT kvm?
>
> Another possible solution was:
> Enhance QEMU user space to monitor the CPU usage of itself, and use
> existing way(pause_all_vcpus?) to pause vcpu thread of KVM in case KVM
> reaches CPU usage limitation. Is this solution possible?

A mgmt daemon can control qemu using the monitor and stop/cont it on 
these cases.

The main problem with the two solutions above is that the guest clock 
might drift. Moreover, you increase the latency for the guest 
OS/applications.

You can use the 'nice' command to priorities the host applications.
For newer kernels you should use cgroups that solves this specific issue 
exactly.

>
> Any idea?
>
>
> Thanks,
> Yu
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2009-08-17  7:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-17  5:09 Limit the CPU usage of KVM Yu Jiang (yujia)
2009-08-17  7:25 ` Dor Laor [this message]
2009-08-17  8:04   ` Yu Jiang (yujia)
2009-08-17  8:14     ` Dor Laor
2009-08-18  8:54       ` Yu Jiang (yujia)
2009-08-18 10:07         ` Dor Laor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A8905DE.7020000@redhat.com \
    --to=dlaor@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=yujia@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).