Context Switches

Discussions related to using VirtualBox on Linux hosts.
Post Reply
nuno
Posts: 40
Joined: 12. May 2007, 01:33

Context Switches

Post by nuno »

Hello!!

I'm just testing VB and the precompiled version is working nicely. However it's a bit slow.

After investigating for 30 seconds I found this with vmstat 1:

Code: Select all

procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 0  0    840  68052      0 1050352    0    0     0     0  110 3051  2  3 95  0
 0  0    840  68124      0 1050352    0    0     0   102  642 6694 20  8 72  0
 1  0    840  67368      0 1050352    0    0     0    21  471 5767  5  6 89  0
 0  0    840  67504      0 1050260    0    0     0    22  402 5228 18  6 77  0
 0  0    840  67588      0 1050260    0    0     0    57  697 7453  7  6 87  0
 1  0    840  67852      0 1050264    0    0     0     8  537 6732 20  7 73  0

---> here I start /usr/bin/VirtualBox

 1  0    840  64996      0 1050264    0    0     0   222  921 37339 27 12 61  0
 0  0    840  63760      0 1050280    0    0     0    18  476 189202 48 17 35  0
 2  0    840  63760      0 1050280    0    0     0     8  525 483841  7 17 76  0
 1  0    840  64008      0 1050312    0    0     0     8  355 384590 20 17 64  0
 0  0    840  64008      0 1050312    0    0     0     0  349 486491  6 16 78  0
 0  0    840  63884      0 1050324    0    0     0   201  417 346671 20 14 67  0
 0  0    840  63952      0 1050324    0    0     0    45  540 493216  8 17 75  0
 1  0    840  63992      0 1050344    0    0     0    22  236 367475 23 17 61  0
 2  0    840  63992      0 1050344    0    0     4    24  263 464226 17 16 67  1
 1  0    840  64240      0 1050360    0    0     0    22  268 412536 17 14 69  1
 0  0    840  63800      0 1050360    0    0     8   182  359 457217  8 16 75  2
 1  0    840  63232      0 1050392    0    0     0    30  366 340499 19 17 63  0
 0  0    840  67172      0 1050392    0    0     0     0 1205 190255 20 15 66  0

13 seconds after, I exit from /usr/bin/VirtualBox.


 4  0    840  67404      0 1050396    0    0     0     7  654 6804 20  9 72  0
 0  0    840  66212      0 1050396    0    0     0     0  329 4471  5  5 90  0
 3  0    840  66040      0 1050424    0    0     0   142  365 11356 25 13 63  0
 5  0    840  66880      0 1050424    0    0     0     8  255 11534 24 11 65  0
 3  0    840  67032      0 1050440    0    0     0    14  264 6883 29  9 63  0
Please note that there isn't any VM running. I'm just starting the GUI, not running any guests. This results in 400000 cs/sec.

When running guests, the problem persists, but with even more cs/sec, something like 600000/sec or more.

By searching the net I found that VB only likes certain kernels. This one is:

Code: Select all

Linux puma 2.6.21-rc7-git7 #1 SMP Wed Apr 25 04:38:05 WEST 2007 i686 GNU/Linux.
And it's running on a dual core with 2gb ram.

I'd really like to use some recent kernel because of some drivers that require a recent tree (DVB's IVTV kernel patch, which is a TV card).

So, is it some option in the kernel that I can try to enable/disable or I must change the kernel's version? If the later, is there a recommended version for the host?

Thanks,
Nuno
nuno
Posts: 40
Joined: 12. May 2007, 01:33

Re: Context Switches

Post by nuno »

I installed a new 2.6.21.1 with the same config but with NO_HZ (dynamic ticks) disabled and now this system's context switches are back to normal while running VB's frontend!!

I still have to compile a few external drivers, thou... Will report back tomorrow.

Peace,
Nuno
achimha
Volunteer
Posts: 217
Joined: 10. May 2007, 09:24

Post by achimha »

When you don't run a VM, VirtualBox is just a normal GUI application, nothing special that would cause a lot of context switches.
nuno
Posts: 40
Joined: 12. May 2007, 01:33

Post by nuno »

achimha wrote:When you don't run a VM, VirtualBox is just a normal GUI application, nothing special that would cause a lot of context switches.
Hello achimha!

It happens with my previous kernel. So I'd say that's not 100% true.

Anyway, with the 2.6.21.1 and more standard kernel config (NO_HZ disabled) it's working OK.

If anyone think this is worth pursuing, I can try to find out if it's the kernel version or some kernel's config option that's responsible for the context switches. Otherwise I'll let it rest because it's working OK now and compiling new kernels for this machine is a pain...

Peace,
Nuno
Post Reply