为什么“Unevictable”内存比“Mlocked”内存大?
$ cp /proc/meminfo meminfo
$ grep -iE "lock|evictable" meminfo
Unevictable: 161436 kB
Mlocked: 12772 kB
$ uname -r # My kernel version
5.0.17-200.fc29.x86_64
“不可战胜”内存的背景链接:
内核是在标准支持下编译的tmpfs
。我看不到任何ramfs
(即任何不可交换的 ram 文件系统)。
$ df -t ramfs
df: no file systems processed
$ cat meminfo
MemTotal: 8042664 kB
MemFree: 3733932 kB
MemAvailable: 5175960 kB
Buffers: 193684 kB
Cached: 1810672 kB
SwapCached: 14628 kB
Active: 2020900 kB
Inactive: 1644208 kB
Active(anon): 1127976 kB
Inactive(anon): 945940 kB
Active(file): 892924 kB
Inactive(file): 698268 kB
Unevictable: 161436 kB
Mlocked: 12772 kB
SwapTotal: 2097148 kB
SwapFree: 1465180 kB
Dirty: 312 kB
Writeback: 0 kB
AnonPages: 1813196 kB
Mapped: 539216 kB
Shmem: 408808 kB
KReclaimable: 160752 kB
Slab: 320584 kB
SReclaimable: 160752 kB
SUnreclaim: 159832 kB
KernelStack: 17792 kB
PageTables: 37288 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 6118480 kB
Committed_AS: 11410784 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
Percpu: 3424 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB
DirectMap4k: 492084 kB
DirectMap2M: 7774208 kB
DirectMap1G: 1048576 kB
[alan@alan-laptop ~]$
背景材料中的一份文件提到
mapping_set_unevictable()
。它说它用于两种情况:它现在用于第三种情况。它适用于 i915 图形缓冲区,如果它们由 GPU 映射:
https://elixir.bootlin.com/linux/v5.0.17/ident/mapping_set_unevictable
“全局图形转换表 (GTT) [...] 负责从 GPU 虚拟地址空间到物理地址的地址映射。” .