Saturday, November 20, 2010

ubuntu - ksm vs apparmor

Lately I was supposed to do some ksm tests to check if it can be used on a multi-user terminal server to reduce the amount of ram consumed by multiple eclipse instances. I started with ubuntu Lucid. I enabled ksm (echo "1" > /sys/kernel/mm/ksm/run). I also launched multiple eclipse and firefox instances. Then I checked /sys/kernel/mm/ksm/pages_shared which showed 0 all the time, even when the machine started swapping.

Then I upgraded to Maverick and also had no luck with ksm - the situation was the same. I also ran a ksm testing procedure described here:

http://dustinkirkland.wordpress.com/2010/02/06/ksm-now-enabled-in-ubuntu-lucid/

still no activity showed by ksm.

As a last resort, I rebooted with kernel option "apparmor=0" and voila - ksm started running!!!

However - I could not find this connection between apparmor and ksm anywhere - so this post is just to inform you - BEFORE YOU RUN KSM ON UBUNTU, ALWAYS TURN APPARMOR OFF

Saturday, November 6, 2010

KVM vs soft lockups

About half a year ago I started using proxmox with KVM for virtualizing my systems. The product itself is brilliant in my opinion, but still suffers from kvm bugs.

I found that some guests would freeze after live migration from one physical host to another. Dmesg on the VMs showed soft lockups on cpus:

BUG: soft lockup - CPU#3 stuck for 10s

Having googled the problem, I found that the problem appears on hosts with virtio drivers (virtio-net and virtio-disk). The probability is even better if you run an smp guest.

To resolve this problem, just switch back to ide emulation and e1000 for network.