From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: context switches and responsiveness Date: Tue, 26 May 2009 12:05:11 +0300 Message-ID: <4A1BB0C7.5000107@redhat.com> References: <4A1BA92C.6060204@nagafix.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: "kvm@vger.kernel.org" To: Antoine Martin Return-path: Received: from mx2.redhat.com ([66.187.237.31]:59087 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752105AbZEZJFZ (ORCPT ); Tue, 26 May 2009 05:05:25 -0400 In-Reply-To: <4A1BA92C.6060204@nagafix.co.uk> Sender: kvm-owner@vger.kernel.org List-ID: Antoine Martin wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > Hi, > > I've recently increased the number of guests (+20%) running on one of my > hosts and found that the responsiveness suffered. > How many guests? How many vcpus? > Before that, the context switches were hovering around 10K, now they're > close to 30K. Or this could just be because I upgraded the host kernel > and kvm: host and guests are running 2.6.29.4 + kvm-86 > Is there anything that can be done to reduce this? > I thought dynticks would prevent unecessary context switching? > dynticks is the default IIRC. What type guests are you running? If Linux, make sure the guests are dynticks as well. > As you can see from the dstat sample below, the host can be very quiet > at times, and yet the guests are a bit sluggish. (there is no swapping > going on in the guests either) > Is 30K context switches normal for a host that's mostly idle?? > Depends on guest count! Please provide kvm_stat output. > Here is a sample guest command line: > - -clock dynticks -usbdevice tablet -m 1024 -monitor > telnet:127.0.0.1:10005,server,nowait -L ./ -kernel ./bzImage-2.6.29.4 > - -append earlyprintk=serial,ttyS0,115200,keep console=ttyS0,115200 > Ah, -usbdevice tablet, interrupt generator from hell. Let it go and you'll see your context switch rate drop. > - ----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system-- > usr sys idl wai hiq siq| read writ| recv send| in out | int csw > 14 15 71 0 0 0| 0 0 | 942B 6912B| 0 0 | 20k 29k > 11 17 71 0 0 0| 0 160k| 460B 818B| 0 0 | 19k 30k > Interrupt rate is close to context switch rate, which is good. -- error compiling committee.c: too many arguments to function