"swiN: clock sio" process taking 75% CPU
Gareth McCaughan
gmccaughan at synaptics-uk.com
Fri Jul 21 14:24:24 UTC 2006
I wrote:
> About 6 minutes after booting (on two occasions; I don't
> guarantee that this doesn't vary), a process that appears
> in the output of "ps" as "[swi4: clock sio]" begins to
> use about 3/4 of the machine's CPU. I think it does so
> more or less instantaneously. It continues to do so
> indefinitely, so far as I can tell.
So, here's the answer. Whether it's the same thing that's
afflicted the other people who've reported similar problems,
I don't know. (Thanks to John Baldwin on -hackers for
pointing me in a useful direction.)
Executive summary: If you see symptoms like the one above,
are you running a syscons screen saver? (To check: run
"kldstat | grep _saver".) If so, turn it off and the problem
may go away.
1. The machine in question runs largely unattended.
2. I'd enabled the syscons screen saver and chosen one
of the ones that puts the screen into a graphics mode.
("warp", as it happens; "fire" behaves similarly;
the character-mode ones don't; I haven't looked at
all of them.)
3. The screen saver kicks in 5 minutes after it gets
turned on in /etc/rc.d/syscons, provided nothing's
happening on the console. Which it isn't: see #1.
4. Now, how do those graphics-mode screen savers work?
They write to the video card's frame buffer directly,
but there's only a 64k block of RAM they can do this
through. So, to cope with larger screens, there's a
bank switching facility accessed by a BIOS call.
5. This BIOS call, on my machine, takes about 0.1ms; you
need to do two of them for a bank switch, so the time
actually taken is about 0.2ms.
6. The screen savers are written in a less than optimal way,
and do that bank switching thing many times. For instance,
the "fire" screen saver does it at least once for every
screen line. Even when the entire screen actually fits
into a single bank so that no switching at all should be
needed.
7. So the screensaver eats up something on the order of half
my CPU time; the exact figure depends on which screensaver
and on more exact timings than I've given above, which is
how it ends up actually being 75% for the "warp" screensaver.
8. The screensaver gets run in callouts from a kernel
interrupt thread that happens to have a silly name
like "swi4: clock sio".
This is eminently fixable, in several different ways. I've
offered to prepare a patch, or perhaps someone else will
do so, so there's a reasonable prospect of later versions
of FreeBSD not having this problem. For the time being,
there's a simple workaround for anyone facing the same
problem I did: *turn off the screensaver*, or replace it
with one that doesn't use a graphics mode.
For clarity: this is a problem with (some) FreeBSD syscons
screen savers, the ones you might enable in /etc/rc.conf;
not with the ones like xscreensaver that you might run in
user mode under X.
--
g
More information about the freebsd-questions
mailing list