前回に引き続き、
linux-2.
カーネルサイズの変遷グラフからlinux-2.
図1を見ると、
このころのLinuxは、
それではlinux-2.
linux-2.1シリーズの概要
linux-2.
前回同様、
| 2. | 2. | 2. | 2. | |
|---|---|---|---|---|
| Documentation | 1100 | 1500 | 2000 | 2500 |
| arch | 5000 | 7200 | 8600 | 9800 |
| drivers | 13000 | 18000 | 23000 | 29000 |
| fs | 2100 | 2300 | 4000 | 4300 |
| include | 3800 | 5900 | 7400 | 8700 |
| init | 28 | 32 | 36 | 40 |
| ipc | 72 | 76 | 64 | 64 |
| kernel | 200 | 224 | 260 | 264 |
| lib | 64 | 64 | 64 | 64 |
| mm | 196 | 248 | 260 | 260 |
| net | 1500 | 2800 | 3200 | 4200 |
| scripts | 284 | 288 | 292 | 296 |
| modules | 0 | - | - | - |
| Total | 27000 | 38000 | 49000 | 59000 |
この表を見ると、
linux-2.
図2は容量の大きいディレクトリのサイズがバージョンごとにどのように変化したかを示しました。このグループにはDocumentation、
2つの図を比べると、
ある意味これは当然の結果で、
事実、
| 2. | 2. | 2. | 2. | |
|---|---|---|---|---|
| alpha | 396 | 516 | 684 | 948 |
| arm | - | - | 492 | 576 |
| i386 | 808 | 892 | 996 | 1100 |
| m68k | 2400 | 2500 | 1900 | 2100 |
| mips | 280 | 1100 | 1200 | 948 |
| ppc | 412 | 376 | 912 | 1300 |
| sparc | 780 | 1300 | 1300 | 1500 |
| sparc64 | - | 756 | 1300 | 1500 |
| total | 5000 | 7200 | 8600 | 9800 |
表に見るように、
NFSパフォーマンスの改善
linux-2.
その一つがNFS
Linuxの開発者たち、
| 2. | 2. | 2. | 2. | |
|---|---|---|---|---|
| 802 | 40 | 288 | 292 | 292 |
| appletalk | 76 | 80 | 76 | 88 |
| ax25 | 156 | 208 | 208 | 212 |
| bridge | 64 | 68 | 68 | 84 |
| core | 128 | 156 | 192 | 192 |
| decnet | 4 | 4 | 4 | 4 |
| econet | - | - | - | 28 |
| ethernet | 20 | 20 | 20 | 20 |
| ipv4 | 680 | 788 | 992 | 1100 |
| ipv6 | 4 | 328 | 368 | 408 |
| ipx | 68 | 68 | 72 | 92 |
| irda | - | - | - | 668 |
| lapb | - | 60 | 60 | 60 |
| netbeui | - | 32 | 32 | - |
| netlink | - | - | 26 | 32 |
| netrom | 104 | 100 | 100 | 104 |
| packet | - | - | 32 | 32 |
| rose | - | 124 | 120 | 136 |
| sched | - | - | 92 | 252 |
| sunrpc | - | 172 | 180 | 180 |
| unix | 44 | 52 | 52 | 52 |
| wanrouter | - | 40 | 40 | 40 |
| x25 | - | 112 | 116 | 116 |
| Total | 1500 | 2800 | 3200 | 4200 |
この表で目を引くのは2.
linux-1.
netディレクトリにsunrpcが追加されたのに合わせて、
こうしてNFS機能をカーネル内部に組み込んだ結果、
NFS関連以外にも、
802ディレクトリには、
またipv4ディレクトリのサイズも倍近くまで増大すると共に、
SMPのパフォーマンス改善
もうひとつ、
カーネル開発者たちがこの問題を解決するために採用したのは、
これは言葉で言うのは簡単なものの、
Linuxの開発者たちがこの膨大な作業に立ち向かっていった過程をソースコードから眺めてみましょう。
まず、
$ find linux-2.1.0 -type f -a -exec grep -i spinlock {} \; -print
extern __inline__ void prim_spin_lock(struct spinlock *sp)
extern __inline__ int prim_spin_unlock(struct spinlock *sp)
extern __inline__ int prim_spin_lock_nb(struct spinlock *sp)
...
linux-2.1.0/include/asm-i386/locks.h
extern inline volatile smp_initlock(void *spinlock)
*((unsigned char *) spinlock) = 0;
linux-2.1.0/include/asm-sparc/smpprim.h
volatile unsigned long smp_invalidate_needed; /* Used for the invalidate map that's also checked in the spinlock */
...
'hlt' instructions and release the spinlock soon. Using 'hlt' is even more
outside of (and by) the spinlock and message code. Amongst other things
linux-2.1.0/Documentation/smp.tex
ソースコード全体を調べても、
$ find linux-2.1.0 -type f -a -exec grep -i spinlock {} \; | wc -l
24
一方、
$ find linux-2.1.45 -type f -a -exec grep -i spinlock {} \; -print
* A simple spinlock to protect the list manipulations
spinlock_t inode_lock = SPIN_LOCK_UNLOCKED;
linux-2.1.45/fs/inode.c
#include <asm/spinlock.h>
linux-2.1.45/fs/binfmt_misc.c
#include <asm/spinlock.h>
spinlock_t scheduler_lock = SPIN_LOCK_UNLOCKED;
static spinlock_t runqueue_lock = SPIN_LOCK_UNLOCKED;
static spinlock_t timerlist_lock = SPIN_LOCK_UNLOCKED;
spinlock_t tqueue_lock;
linux-2.1.45/kernel/sched.c
...
linux-2.
$ find linux-2.1.90 -type f -a -exec grep -i spinlock {} \; -print
...
#include
void _spin_lock(spinlock_t *lock)
void _spin_unlock(spinlock_t *lp)
linux-2.1.90/arch/ppc/lib/locks.c
static spinlock_t regdump_lock = SPIN_LOCK_UNLOCKED;
extern spinlock_t scheduler_lock;
linux-2.1.90/arch/sparc64/kernel/process.c
...
spinlock_t irq_controller_lock;
linux-2.1.90/arch/arm/kernel/irq.c
#include <asm/spinlock.h>
linux-2.1.90/arch/arm/kernel/traps.c
...
さらにlinux-2.
$ find linux-2.1.132 -type f -a -exec grep -i spinlock {} \; -print
...
#include <asm/spinlock.h>
spinlock_t lock;
/* Set the spinlock before grabbing IRQ! */
((struct el3_private *)dev->priv)->lock = (spinlock_t) SPIN_LOCK_UNLOCKED;
linux-2.1.132/drivers/net/3c509.c
#include <asm/spinlock.h>
spinlock_t lock;
linux-2.1.132/drivers/net/plip.c
* 0.6 05.04.98 add spinlocks
linux-2.1.132/drivers/net/hamradio/hdlcdrv.c
1998-10-21 Postponed the spinlock changes, would need a lot of
linux-2.1.132/drivers/net/hamradio/scc.c
#include <asm/spinlock.h>
spinlock_t lock;
sp->lock = (spinlock_t) SPIN_LOCK_UNLOCKED;
linux-2.1.132/drivers/net/eepro100.c
...
#include <asm/spinlock.h>
linux-2.1.132/drivers/scsi/eata_pio.c
* Converted cli() code to spinlocks, Ingo Molnar
#include <asm/spinlock.h>
* We need a spinlock here, or compare and exchange if we can reorder incoming
/* The detect routine must carefully spinunlock/spinlock if
spinlock as well.
spinlock. For the time beeing let's use it only for drivers
* FIXME(eric) put a spinlock on this. We force all of the devices offline
linux-2.1.132/drivers/scsi/scsi.c
...
もっとも、
* The spinlock is silly - we should really lock more of this * is around this - scsi_sleep() assumes we hold the spinlock. linux-2.1.132/drivers/scsi/sr_ioctl.c
みたいなコメントが引っかかっていることもあって、
以上紹介してきたように、
これはソースコードそのものとは関係ありませんが、
$ diff -u linux-2.1.{0,132}/MAINTAINERS
-REST:
+THE REST
P: Linus Torvalds
-S: Buried alive in email
+S: Buried alive in diapers
2.
時の流れの早さを改めて感じると共に、
