kernel: __alloc_pages: 0-order allocation failed (gfp=0x1f0/0)

queue
kernel: __alloc_pages: 0-order allocation failed (gfp=0x1f0/0)

有一台 2.4.30 内核的 linux 机器,最近频繁地死机。在重启之后,从 /var/log/messages 中找到如下的错误信息

Apr  6 18:16:00 xxx kernel: __alloc_pages: 1-order allocation failed (gfp=0x1f0/0)
Apr  6 18:16:00 xxx kernel: __alloc_pages: 0-order allocation failed (gfp=0x1f0/0)
Apr  6 18:16:00 xxx kernel: __alloc_pages: 0-order allocation failed (gfp=0x1f0/0)
Apr  6 18:16:00 xxx kernel: __alloc_pages: 1-order allocation failed (gfp=0x1f0/0)
Apr  6 18:16:08 xxx kernel: __alloc_pages: 0-order allocation failed (gfp=0xf0/0)
Apr  6 18:16:14 xxx kernel: __alloc_pages: 0-order allocation failed (gfp=0x1f0/0)

死机之前的系统情况大概是这样的:

Sun Apr  6 18:15:01 CST 2008
18:15:01 up 23 days,  2:22,  0 users,  load average: 2.01, 1.99, 1.86
             total       used       free     shared    buffers     cached
Mem:          2020       1845        174          0          2        701
-/+ buffers/cache:       1142        877
Swap:         2000          0       2000
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
2  7    128 178472   2176 718244    0    0     2     4    4     5 14  2 84  0
1  5    128 183960   2540 721408    0    0  3416   728 2407  2875 18 29 53  0
0 31    128 174696   2960 729636    0    0  7860  1688 2275  2515  5 19 76  0
0 35    128 179772   2920 732368    0    0  2684  3036 2743  3385 16 10 74  0
2 49    128 177036   4352 734416    0    0  3008  1004 2933  4051  7 12 81  0

CPU 是 4 块 Xeon 3G ,内存是 2G 。

有两个问题:
1.有人遇到过类似的问题吗?可能是什么原因造成系统死机的?
2.如果在发现系统出现这样的情况的时候,立即停掉运行的应用程序能不能使系统恢复?

platinum
大概是内核空间内存不够造成的,你跑了什么东西占了这么大内核空间?

queue
[quote]原帖由 [i]platinum[/i] 于 2008-4-10 22:57 发表 [url=http://linux.chinaunix.net/bbs/redirect.php?goto=findpost&pid=6549048&ptid=990748][img]http://linux.chinaunix.net/bbs/images/common/back.gif[/img][/url]
大概是内核空间内存不够造成的,你跑了什么东西占了这么大内核空间? [/quote]

你的意思是说程序里面创建了太多需要占用内核空间的资源?比如 文件句柄,mmap 之类的东西?
这个程序使用了 mmap 来读取文件,因为文件内容是有一定格式的,先 mmap ,直接在 mmap 的内存快上进行格式分析。
但是每个 mmap 成功之后,在分析完内容之后,都立即做了 munmap 的。
难道频繁地使用 mmap 会存在问题?

platinum
我没用过 mmap,但以前再用 kmalloc 的时候遇到过类似的提示
由于逻辑上的问题,没有 kfree,导致内核空间被逐渐耗尽

queue
在这里看到有一个 novell 的官方声明,似乎 2.4 的内核曾经存在这样的一个 BUG 。

[url]http://www.novell.com/linux/security/advisories/2006_64_kernel.html[/url]

   The Linux kernel in our old Linux 2.4 kernel based distributions have
   been updated to fix various security issues and bugs.

   - Fixed some server crashes with "__alloc_pages: 1-order allocation failed
     (gfp=0x1f0/0)" errors.