Friday, December 24, 2010

Christmas Tree

Christmas tree I made this year



Merry Christmas!

Tuesday, December 21, 2010

2010 LLVM Developers' Meeting

Videos from `2010 LLVM Developers' Meeting' now available here

Thursday, December 16, 2010

acer aspire

kernel: [37201.728875] CPU2: Core temperature above threshold, cpu clock throttled (total events = 1)
kernel: [37201.728880] CPU3: Core temperature above threshold, cpu clock throttled (total events = 1)
kernel: [37201.729881] CPU3: Core temperature/speed normal
kernel: [37201.729884] CPU2: Core temperature/speed normal
kernel: [37301.339112] [Hardware Error]: Machine check events logged
kernel: [37501.209513] CPU2: Core temperature above threshold, cpu clock throttled (total events = 4206)
kernel: [37501.209517] CPU3: Core temperature above threshold, cpu clock throttled (total events = 4206)
kernel: [37501.210542] CPU2: Core temperature/speed normal
kernel: [37501.210546] CPU3: Core temperature/speed normal


For the first time I have an emergency poweroff due to CPU overheat.
Acer Aspire is definetly a bullshit.

Thursday, December 9, 2010

yet another perl limitation

Another funny thing about perl.
Suppose, $i is 4.


while ($i > 0) {
    $i--;

    next if ($i == 2);

    print $i, "\n";
}


will produce
3 1 0


which is quite expected result. So far, so good.

Moving to do-while

do {
    $i--;

    next if ($i == 2);

    print $i, "\n";
} while ($i > 0);


Oops, bad luck:
3
Can't "next" outside a loop block at ./test.pl line 10.

And at the same time
do {
    $i--;

    next if ($i == 2);

    print $i, "\n";
} for (1 .. $i);


will happy to write
3 1 0

Guess why?

perldoc will shed light:
do BLOCK does not count as a loop, so the loop control statements next, last, or redo cannot be used to leave or restart the block. See perlsyn for alternative strategies.

Well... dunno... Hope, they really had reasons to do so.

Tuesday, December 7, 2010

sched: automated per tty task groups

For sure, you already heard about those magic 220 lines
to blow your head off (yes, "[RFC/RFT PATCH v3] sched: automated
per tty task groups").

Lennart Poettering, however, proposed similar solution, yet
without any need to patch your kernel.

I've changed it a bit, since original didn't work for me.
I added those lines to the end of .bashrc:
if [ "$PS1" ] ; then
    mkdir -m 0700 /cgroup/cpu/user/$$
    echo $$ > /cgroup/cpu/user/$$/tasks
fi


and to /etc/rc.local:
mount -t cgroup cgroup /cgroup/cpu -o cpu
mkdir -p -m 0777 /cgroup/cpu/user

Quick test:
ls /cgroup/cpu/user/
11564 1164 15342 24870 28728 3746 3812 ...


Tested while compiling kernel -j16, emacs -j8 and a few
things in the meantime...
Seems to work.

The truth behind the scene is that the kernel is much more
complicated than they told you in books.

P.S.
It may require libcgroup