Gamin… sigh..

So you ever had your system going tremendously slow? Have you ever been unable to get the mouse events straight to X? And how many times did you find the cause in gam_server sucking up your CPU’s cycles?
Myself, too many times.

Tonight I was pissed off.. I was unable to watch a DVD, and originally I thought the problem was with the double compilation both locally and via distcc for Farragut, and I ended up stressed on #gentoo-dev.

Basically, I was wondering why on earth, gam_server was running lstat() on a good deal of my files, even though I have inotify enabled. At first I thought the problem was with the inotify limits, but that wasn’t the case. I’ve maxed out the limits of inotify, and run gam_server by root, but identical result, lstat() all over the place.

That was luckily a good thing, as thanks to Patrick and Jakub, a solution was found 🙂 In particular, Jakub pointed me at the documentation (not available on the installed files :/) at Gamin Site that states how to set a gaminrc file. In particular, there’s a way to enable the kernel notification (that is, inotify for Linux, kqueue for FreeBSD), that doesn’t really seem to be enabled by default.

All you have to do it seems to be to add a /etc/gamin/gaminrc file this way:

notify /*

This way you tell gamin to use inotify, that finally makes it not to take lots of CPU to work.

Unfortunately, you need to restart the programs that are taking gam_server up, so either your X session or the whole system. Myself I just rebooted as I had to change kernel (I should have shut it down, as I have to reset the audio card that doesn’t seem to work that well :/)

Now it doesn’t bother me anymore, although the documentation about gaminrc is not installed by default, the only references to that (important) configuration file are in NEWS.gz and ChangeLog.gz.

Oh well, I hope this might be useful to know, and thanks again to Jakub and Patrick 🙂