Linux LowFree和Slab

时间:2017-06-04 15:35:54

标签: linux memory-leaks

目前,我的路由器遇到了一个令人疲惫的情况,MemoryFree一直在增长,但在搜索/ proc / meminfo时没有人成长!怎么会发生这种情况?

一开始:

MemTotal:         513112 kB
MemFree:          453244 kB
MemAvailable:     397132 kB
Buffers:            3664 kB
Cached:            11428 kB
SwapCached:            0 kB
Active:            10476 kB
Inactive:           8036 kB
Active(anon):       3512 kB
Inactive(anon):     1024 kB
Active(file):       6964 kB
Inactive(file):     7012 kB
Unevictable:           0 kB
Mlocked:               0 kB
HighTotal:         65536 kB
HighFree:          62968 kB
LowTotal:         447576 kB
LowFree:          390276 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:          3552 kB
Mapped:             3016 kB
Shmem:              1116 kB
Slab:              15412 kB
SReclaimable:       2952 kB
SUnreclaim:        12460 kB
KernelStack:         632 kB
PageTables:          396 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      256556 kB
Committed_AS:      14288 kB
VmallocTotal:    1015800 kB
VmallocUsed:        7816 kB
VmallocChunk:     990320 kB

几天后:

MemTotal:         513112 kB
MemFree:          298280 kB
MemAvailable:     241060 kB
Buffers:            3068 kB 
Cached:            10700 kB
SwapCached:            0 kB
Active:            11084 kB
Inactive:           6284 kB
Active(anon):       4112 kB
Inactive(anon):     1180 kB
Active(file):       6972 kB
Inactive(file):     5104 kB
Unevictable:           0 kB
Mlocked:               0 kB
HighTotal:         65536 kB
HighFree:          62164 kB
LowTotal:         447576 kB
LowFree:          236116 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:          3644 kB
Mapped:             3064 kB
Shmem:              1692 kB
Slab:              17224 kB
SReclaimable:       2632 kB
SUnreclaim:        14592 kB
KernelStack:         576 kB
PageTables:          392 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      256556 kB
Committed_AS:      14904 kB
VmallocTotal:    1015800 kB
VmallocUsed:        7656 kB
VmallocChunk:     952764 kB

由于SLAB区域没有显着变化,因此泄漏不能被kmalloc / kfree API及其同伴泄露(LowFree正在减少,因此泄漏必须放在内核空间中的某处)。有谁能够帮我? 抱歉我的英语很差。

1 个答案:

答案 0 :(得分:1)

最后,我发现泄漏是由MTK WIFI驱动程序引起的,该驱动程序调用dev_alloc_skb来分配skb并忘记释放它。 dev_alloc_skb在内部通过alloc_pages直接分配skb->数据,而不是由slab记录。