dmesgに見えるエラーは以下のような感じ。
[ 7873.855883] swapper: page allocation failure. order:0, mode:0x20 [ 7873.855895] Pid: 0, comm: swapper Not tainted 2.6.32-5-686 #1 [ 7873.855899] Call Trace: [ 7873.855935] [<c108c9a2>] ? __alloc_pages_nodemask+0x484/0x4d9 [ 7873.855945] [<c10ae77e>] ? alloc_slab_page+0x18/0x1b [ 7873.855951] [<c10ae8c0>] ? __slab_alloc+0x13f/0x431 [ 7873.855958] [<c10aed44>] ? kmem_cache_alloc+0x6d/0xe5 [ 7873.855968] [<c11d3f19>] ? __alloc_skb+0x29/0x115 [ 7873.855974] [<c11d3f19>] ? __alloc_skb+0x29/0x115 [ 7873.855980] [<c11d3f19>] ? __alloc_skb+0x29/0x115 [ 7873.855987] [<c11d4cc4>] ? __netdev_alloc_skb+0x14/0x30 [ 7873.856023] [<d0a59a08>] ? e100_rx_alloc_skb+0x1e/0x11d [e100] [ 7873.856035] [<d0a5bbb1>] ? e100_poll+0x1d6/0x29d [e100] [ 7873.856056] [<c11da231>] ? net_rx_action+0x96/0x194 [ 7873.856070] [<c1035a96>] ? __do_softirq+0xaa/0x156 [ 7873.856077] [<c1035b73>] ? do_softirq+0x31/0x3c [ 7873.856083] [<c1035c4d>] ? irq_exit+0x26/0x58 [ 7873.856101] [<c1004699>] ? do_IRQ+0x78/0x89 [ 7873.856108] [<c10037f0>] ? common_interrupt+0x30/0x38 [ 7873.856133] [<c101aacc>] ? native_safe_halt+0x2/0x3 [ 7873.856143] [<c1008813>] ? default_idle+0x3c/0x5a [ 7873.856149] [<c1002377>] ? cpu_idle+0x89/0xa2 [ 7873.856169] [<c13bf7fc>] ? start_kernel+0x318/0x31d [ 7873.856174] Mem-Info: [ 7873.856178] DMA per-cpu: [ 7873.856182] CPU 0: hi: 0, btch: 1 usd: 0 [ 7873.856185] Normal per-cpu: [ 7873.856189] CPU 0: hi: 90, btch: 15 usd: 89 [ 7873.856200] active_anon:762 inactive_anon:827 isolated_anon:0 [ 7873.856202] active_file:28611 inactive_file:28682 isolated_file:0 [ 7873.856205] unevictable:0 dirty:1 writeback:0 unstable:0 [ 7873.856207] free:427 slab_reclaimable:774 slab_unreclaimable:2329 [ 7873.856209] mapped:8735 shmem:0 pagetables:234 bounce:0 [ 7873.856226] DMA free:992kB min:124kB low:152kB high:184kB active_anon:64kB inactive_anon:116kB active_file:7056kB inactive_file:7328kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15872kB mlocked:0kB dirty:0kB writeback:0kB mapped:1796kB shmem:0kB slab_reclaimable:76kB slab_unreclaimable:292kB kernel_stack:8kB pagetables:16kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no [ 7873.856237] lowmem_reserve[]: 0 238 238 238 [ 7873.856251] Normal free:716kB min:1908kB low:2384kB high:2860kB active_anon:2984kB inactive_anon:3192kB active_file:107388kB inactive_file:107400kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:243776kB mlocked:0kB dirty:8kB writeback:0kB mapped:33144kB shmem:0kB slab_reclaimable:3020kB slab_unreclaimable:9024kB kernel_stack:640kB pagetables:920kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:86 all_unreclaimable? no [ 7873.856262] lowmem_reserve[]: 0 0 0 0 [ 7873.856268] DMA: 0*4kB 2*8kB 1*16kB 0*32kB 5*64kB 1*128kB 2*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 992kB [ 7873.856284] Normal: 179*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 716kB [ 7873.856300] 57660 total pagecache pages [ 7873.856304] 363 pages in swap cache [ 7873.856308] Swap cache stats: add 13396, delete 13033, find 2464/3626 [ 7873.856312] Free swap = 346240kB [ 7873.856315] Total swap = 369452kB [ 7873.859847] 65520 pages RAM [ 7873.859847] 0 pages HighMem [ 7873.859847] 1858 pages reserved [ 7873.859847] 20298 pages shared [ 7873.859847] 50296 pages non-shared [ 7873.859847] SLUB: Unable to allocate memory on node -1 (gfp=0x20) [ 7873.859847] cache: kmalloc-192, object size: 192, buffer size: 192, default order: 0, min order: 0 [ 7873.859847] node 0: slabs: 105, objs: 2205, free: 0
ページキャッシュが開放されるタイミングを左右するパラメータが小さすぎる(物理メモリの空きがvm.min_free_kbytesの設定値を下回るとページキャッシュが開放される)ことが問題。まずはこのパラメータに設定された値を確認。先のエラーが生じた物理メモリ256MBのマシンで確認。デフォルトの計算式に従うなら、4 * sqrt(256E+3) = 2 023.8577 で大体同じくらい。
# sysctl vm.min_free_kbytes vm.min_free_kbytes = 2038 # cat /proc/sys/vm/min_free_kbytes 2038
エラーが生じていない物理メモリ1024MBのマシンで確認。デフォルトの計算式に従うなら、4 * sqrt(1024E+3) = 4047.71541 だけど、ちょっと違う。
# sysctl vm.min_free_kbytes vm.min_free_kbytes = 3789 # cat /proc/sys/vm/min_free_kbytes 3789
一時的に変えるには、echoで書き込む。ここでは4096 KBを設定。
# echo 4096 > /proc/sys/vm/min_free_kbytes # sysctl vm.min_free_kbytes vm.min_free_kbytes = 4096 # cat /proc/sys/vm/min_free_kbytes 4096
恒久的、永続的に変えるには、/etc/sysctl.conf または /etc/sysctl.d/*.conf を編集。ここでは 4096 KBを設定。編集後に sysctl -p を忘れずに。
# echo vm.min_free_kbytes=4096 >> /etc/sysctl.d/local.conf # sysctl -p net.ipv4.ip_forward = 1 vm.min_free_kbytes = 4096