CPU’s iowait (wa in top(1))

Ptt’s CPU is eaten a lot in the part of iowait, we thought iowait means disk I/O. But with DMA, why CPU takes such a lot of CPU time?

Trace into the kernel, I found the time of iowait will be added inside io_schedule():

void __sched io_schedule(void)
{
   struct runqueue *rq = &per_cpu(runqueues, _smp_processor_id());

   atomic_inc(&rq->nr_iowait);
   schedule();
   atomic_dec(&rq->nr_iowait);
}

During the context switch from the middle, each time interrupt increase the value if nr_iowait is true. So iowait is no longer the waiting time of I/O. Of course it can be omitted if the process number is small, but ptt has more than 25000 process …

有趣的一些 perl module

原來惡搞的 perl module 那麼多 orz,Acme 裡面好像都是惡搞的耶 XD 隨便來幾個

Acme::BadExample

use Acme::BadExample;

然後就 compile 不過了 orz


Acme::Bleach

#!/usr/bin/perl
use Acme::Bleach
print "blah";

然後執行這個檔之後,這個檔就只剩 use Acme::Bleach 了 orz!
所有 printable character 都會被變成 tab/space。 讓我想到王尹的泡沫化程式 ^^;


Acme::Debug

use 之後 如果開 debugger mode,會把程式碼裡面含 b, u, g 的 subsequence 找出來 O_o


Acme::ComeFrom

goto 的逆向操作 autrijus 的作品,不太直覺就是了 ^^;

不過也有另一些不同的有趣的 ^^;
像是 use Acme::Intraweb; 之後如果 use use SomeModule; 但是 @INC 找不到的話,
他就直接上網抓下來 O_O

Have fun! :D

ext3 sucks!!

Everybody went home during the Chinese New Year. Gosh, the power of the dorm went off line during this time. My BIOS was set properly, so everything went very well before. But it didn’t this time. My computer was halt for about 10 days @@; After coming back, I found it caused by corrupt ext3. It sucks, non-journal fs can fsck after the booting at least, but my ext3 dead in the loader -_- I won’t use ext3 anymore.

power consumption

放寒假這段時間,無聊的時候做了這個測試,在我的 notebook (ThinkPad R40 2722-2v1) 上 activate/deactivate 硬體、跟 start/stop 程式對電池電力的消耗功率的影響。不同的測試之間我大概會等個 2 ~ 3 分鐘左右,功率的觀察是透過 /proc/acpi/battery/BAT0/state。

kernel Linux 2.6.10 under scaling governor “powersave”

 console login                     (-----)
 10427  <--- 目前功率
 turn the back-light to min        (-2373)   --- 做了前面這件事後的功率變化
 8054
 max light, eject bay              (-2081)
 10135
 startx                            (+648)
 10783
 eject bay                         (-284)
 10499
 modprobe ipw2100                  (+1407)
 11906
 modprobe -r uhci_hcd              (-1148)
 10758
 start seti@home                   (+3136)
 13894
 press "led" button                (-3674)
 10220