page allocation failure messages分析

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/dongkun152/article/details/80822563

page allocation failure messages 分析

page allocation failure messages

一个典型的page allocation failure message from linux on MIPS CPU

rmm: page allocation failure: order:4, mode:0x104020
CPU: 0 PID: 784 Comm: rmm Tainted: G           O 3.10.27 #6
Stack : 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
          00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
          00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
          00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
          00000000 00000000 00000000 00000000 00000000 00000000 00000000 82fd1560
          ...
Call Trace:[<80018a1c>] 0x80018a1c
[<80018a1c>] 0x80018a1c
[<8006ec9c>] 0x8006ec9c
[<800713b4>] 0x800713b4
[<80071664>] 0x80071664
[<801f5108>] 0x801f5108
[<801e0fd4>] 0x801e0fd4
[<8016a89c>] 0x8016a89c
[<c0261ec4>] 0xc0261ec4
[<80045cc4>] 0x80045cc4
[<8016a89c>] 0x8016a89c
[<c022115c>] 0xc022115c
[<8002998c>] 0x8002998c
[<c0261388>] 0xc0261388
[<801f4f80>] 0x801f4f80
[<801dfacc>] 0x801dfacc
[<801edca4>] 0x801edca4
[<801eeb1c>] 0x801eeb1c
[<801f3bac>] 0x801f3bac
[<8004312c>] 0x8004312c
[<80050f48>] 0x80050f48
[<80045d98>] 0x80045d98
[<801f4b20>] 0x801f4b20
[<80050f48>] 0x80050f48
[<80057744>] 0x80057744
[<801deec8>] 0x801deec8
[<8016a89c>] 0x8016a89c
[<8005fce4>] 0x8005fce4
[<80066914>] 0x80066914
[<80065d38>] 0x80065d38
[<8016a89c>] 0x8016a89c
[<8006318c>] 0x8006318c
[<8005f5a8>] 0x8005f5a8
[<800295ac>] 0x800295ac
[<80016668>] 0x80016668
[<80015460>] 0x80015460
[<80179888>] 0x80179888
[<80179d80>] 0x80179d80
[<8017a510>] 0x8017a510
[<80178a78>] 0x80178a78
[<801012d0>] 0x801012d0
[<800fd710>] 0x800fd710
[<80043118>] 0x80043118
[<800fdb04>] 0x800fdb04
[<800ff254>] 0x800ff254
[<800748e0>] 0x800748e0
[<c0456424>] 0xc0456424
[<801a59e0>] 0x801a59e0
[<80074aac>] 0x80074aac
[<8009d068>] 0x8009d068
[<8006c6d4>] 0x8006c6d4
[<8009cefc>] 0x8009cefc
[<800966f0>] 0x800966f0
[<80083e04>] 0x80083e04
[<80086774>] 0x80086774
[<80089b54>] 0x80089b54
[<8008bb58>] 0x8008bb58
[<800873bc>] 0x800873bc
[<801642ac>] 0x801642ac
[<8001cd98>] 0x8001cd98
[<8008c078>] 0x8008c078
[<80164360>] 0x80164360
[<8035194c>] 0x8035194c
[<8007f418>] 0x8007f418
[<80094b60>] 0x80094b60
[<800b40a8>] 0x800b40a8
[<800963cc>] 0x800963cc
[<8008a690>] 0x8008a690
[<80040000>] 0x80040000
[<80015464>] 0x80015464
[<80080008>] 0x80080008
[<80097c14>] 0x80097c14

Mem-Info:
Normal per-cpu:
CPU    0: hi:    6, btch:   1 usd:   5
active_anon:1654 inactive_anon:453 isolated_anon:0
 active_file:30 inactive_file:27 isolated_file:8
 unevictable:255 dirty:0 writeback:0 unstable:0
 free:1887 slab_reclaimable:290 slab_unreclaimable:1492
 mapped:485 shmem:456 pagetables:84 bounce:0
 free_cma:0
Normal free:7548kB min:736kB low:920kB high:1104kB active_anon:6616kB inactive_anon:1812kB active_file:120kB inactive_file:108kB unevictable:1020kB isolated(anon):0kB isolated(file):32kB present:65536kB managed:34088kB mlocked:0kB dirty:0kB writeback:0kB mapped:1940kB shmem:1824kB slab_reclaimable:1160kB slab_unreclaimable:5968kB kernel_stack:848kB pagetables:336kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0
Normal: 609*4kB (UMR) 331*8kB (UMR) 142*16kB (EMR) 4*32kB (MR) 1*64kB (U) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 7548kB
776 total pagecache pages

进程地址空间分布

user space:0x0000 0000 - 0x7FFF FFFF 其中动态库在用户空间高地址
这里写图片描述
kernel space:0x8000 0000 - 0xFFFF FFFF

解释

rmm: page allocation failure: order:4, mode:0x104020
这个错误是在内核分配page时失败。rmm是当前进程名,order:4 表示2^4 个连续的page即16个page=64kb。内存碎片会导致连续的page分配失败,即使当时还有很多空闲的page。当order: 0 分配失败时,表示系统当前已经完全out of memory。
mode表示分配的页模式。是传给内核内存分配器的flag, 具体的标示在 include/linux/gfp.h文件中。

CPU: 0 PID: 784 Comm: rmm Tainted: G           O 3.10.27 #6

pid是784, 内核版本是3.10.27

Mem-Info:
Normal per-cpu:
CPU    0: hi:    6, btch:   1 usd:   5
active_anon:1654 inactive_anon:453 isolated_anon:0
 active_file:30 inactive_file:27 isolated_file:8
 unevictable:255 dirty:0 writeback:0 unstable:0
 free:1887 slab_reclaimable:290 slab_unreclaimable:1492
 mapped:485 shmem:456 pagetables:84 bounce:0
 free_cma:0
Normal free:7548kB min:736kB low:920kB high:1104kB active_anon:6616kB inactive_anon:1812kB active_file:120kB inactive_file:108kB unevictable:1020kB isolated(anon):0kB isolated(file):32kB present:65536kB managed:34088kB mlocked:0kB dirty:0kB writeback:0kB mapped:1940kB shmem:1824kB slab_reclaimable:1160kB slab_unreclaimable:5968kB kernel_stack:848kB pagetables:336kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0
Normal: 609*4kB (UMR) 331*8kB (UMR) 142*16kB (EMR) 4*32kB (MR) 1*64kB (U) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 7548kB
776 total pagecache pages

输出meminfo的是show_mem()函数再lib/show_mem.c中, 其中的 show_free_areas() 函数(在mm/page_alloc.c中)打印了这些信息。
该cpu只有一个normal 内存区域zone 它的mem watermark信息如下

  Normal free:7548kB min:736kB low:920kB high:1104kB

最后是空闲page的分布信息

Normal: 609*4kB (UMR) 331*8kB (UMR) 142*16kB (EMR) 4*32kB (MR) 1*64kB (U) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 7548kB

这里64kb连续内存页还有数量1, 但是仍然引发了分配失败。
分配打order的内存不会引发oom killer, 只有order 《=3 的内存分配失败才会触发oom killer。

展开阅读全文

Channel Allocation

07-27

DescriptionnnWhen a radio station is broadcasting over a very large area, repeaters are used to retransmit the signal so that every receiver has a strong signal. However, the channels used by each repeater must be carefully chosen so that nearby repeaters do not interfere with one another. This condition is satisfied if adjacent repeaters use different channels. nnSince the radio frequency spectrum is a precious resource, the number of channels required by a given network of repeaters should be minimised. You have to write a program that reads in a description of a repeater network and determines the minimum number of channels required.nInputnnThe input consists of a number of maps of repeater networks. Each map begins with a line containing the number of repeaters. This is between 1 and 26, and the repeaters are referred to by consecutive upper-case letters of the alphabet starting with A. For example, ten repeaters would have the names A,B,C,...,I and J. A network with zero repeaters indicates the end of input. nnFollowing the number of repeaters is a list of adjacency relationships. Each line has the form: nnA:BCDH nnwhich indicates that the repeaters B, C, D and H are adjacent to the repeater A. The first line describes those adjacent to repeater A, the second those adjacent to B, and so on for all of the repeaters. If a repeater is not adjacent to any other, its line has the form nnA: nnThe repeaters are listed in alphabetical order. nnNote that the adjacency is a symmetric relationship; if A is adjacent to B, then B is necessarily adjacent to A. Also, since the repeaters lie in a plane, the graph formed by connecting adjacent repeaters does not have any line segments that cross. nOutputnnFor each map (except the final one with no repeaters), print a line containing the minumum number of channels needed so that no adjacent channels interfere. The sample output shows the format of this line. Take care that channels is in the singular form when only one channel is required.nSample Inputnn2nA:nB:n4nA:BCnB:ACDnC:ABDnD:BCn4nA:BCDnB:ACDnC:ABDnD:ABCn0nSample Outputnn1 channel needed.n3 channels needed.n4 channels needed. 问答

没有更多推荐了,返回首页