网络启动初始化函数入口为net/socket.c:2200:socket_init() static int __init sock_init(void) { /* * Initialize sock SLAB cache. */ sk_init(); /* * Initialize skbuff SLAB cache */ skb_init(); /* * Initialize the protocols module. */ init_inodecache(); register_filesystem(&sock_fs_type); sock_mnt = kern_mount(&sock_fs_type); /* The real protocol initialization is performed in later initcalls. */ #ifdef CONFIG_NETFILTER netfilter_init(); #endif return 0; } sock_init()函数结构很简单,实现的功能也非常简单,下面逐个进行解析: 1.sk_init() void __init sk_init(void) { if (num_physpages <= 4096) { sysctl_wmem_max = 32767; sysctl_rmem_ma