zfs again

今天才發現我弄錯了,昨天那篇提到的只是不會 cache,不會導致 kmem_map too small。

http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/contrib/opensolaris/uts/common/fs/zfs/arc.c

version 1.4 調了一些參數試圖緩和 memory 用光的情形…

zfs 雷

i386 跑 zfs 很容易會遇到 kmem_map too small,然後 panic。(搞錯了,不是這個 patch,請看下一篇)

剛才 rafan 貼了一段 message 給我

Change type of kmem_used() and kmem_size() functions to uint64_t, so it
doesn’t overflow in arc.c in this check:

if (kmem_used() > (kmem_size() * 4) / 5)
return (1);

With this bug ZFS almost doesn’t cache.

Only 32bit machines are affected that have vm.kmem_size set to values >=1GB.

src/sys/compat/opensolaris/kern/opensolaris_kmem.c#rev1.3,還有 diff

搞笑 XD

slab in Linux kernel

之前看了 <<Linux Kernel Development>> 中談到 Memory Management 那章。今天剛好在 irc 上聊到,這是一點點對 slab 的介紹 :P

22:31  slab 算是 kernel 裡面 kmalloc 的一個 "page (概念上)"
22:32  kernel 裡面會對各種不同的 slab 作 cache 之類的
22:33  slabtop(1) 可以看不同 slab 中的最大值 (對各個欄位)

22:36  slab 的 cache 是這樣的,因為去拿一個新的 slab 的 cost 比較高,
                所以每當有 slab 被 free 掉時,會存起來當 cache
22:37  100% usage 可能是目前站上比較 active :Q
22:38  slab 應該沒有什麼夠不夠的

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 …

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.