![如何计算所需的值并指定mtrr_gran_size/mtrr_chunk_size?](https://linux22.com/image/1019369/%E5%A6%82%E4%BD%95%E8%AE%A1%E7%AE%97%E6%89%80%E9%9C%80%E7%9A%84%E5%80%BC%E5%B9%B6%E6%8C%87%E5%AE%9Amtrr_gran_size%2Fmtrr_chunk_size%EF%BC%9F.png)
我有 16GB RAM 和 8GB 交换内存。我正在运行 Kubuntu。
在启动后检查日志时,我看到其中一部分内容:“mtrr_cleanup:找不到最佳值,内核:[0.003112]请指定mtrr_gran_size/mtrr_chunk_size”
Jul 20 02:45:56 user-System kernel: [ 0.003101] gran_size: 128M chunk_size: 128M num_reg: 7 lose cover RAM: 174M
Jul 20 02:45:56 user-System kernel: [ 0.003102] gran_size: 128M chunk_size: 256M num_reg: 9 lose cover RAM: 174M
Jul 20 02:45:56 user-System kernel: [ 0.003103] gran_size: 128M chunk_size: 512M num_reg: 10 lose cover RAM: 174M
Jul 20 02:45:56 user-System kernel: [ 0.003103] gran_size: 128M chunk_size: 1G num_reg: 9 lose cover RAM: 174M
Jul 20 02:45:56 user-System kernel: [ 0.003104] gran_size: 128M chunk_size: 2G num_reg: 10 lose cover RAM: 174M
Jul 20 02:45:56 user-System kernel: [ 0.003105] gran_size: 256M chunk_size: 256M num_reg: 5 lose cover RAM: 430M
Jul 20 02:45:56 user-System kernel: [ 0.003105] gran_size: 256M chunk_size: 512M num_reg: 5 lose cover RAM: 430M
Jul 20 02:45:56 user-System kernel: [ 0.003106] gran_size: 256M chunk_size: 1G num_reg: 6 lose cover RAM: 430M
Jul 20 02:45:56 user-System kernel: [ 0.003107] gran_size: 256M chunk_size: 2G num_reg: 7 lose cover RAM: 430M
Jul 20 02:45:56 user-System kernel: [ 0.003107] gran_size: 512M chunk_size: 512M num_reg: 5 lose cover RAM: 430M
Jul 20 02:45:56 user-System kernel: [ 0.003108] gran_size: 512M chunk_size: 1G num_reg: 6 lose cover RAM: 430M
Jul 20 02:45:56 user-System kernel: [ 0.003109] gran_size: 512M chunk_size: 2G num_reg: 7 lose cover RAM: 430M
Jul 20 02:45:56 user-System kernel: [ 0.003109] gran_size: 1G chunk_size: 1G num_reg: 4 lose cover RAM: 942M
Jul 20 02:45:56 user-System kernel: [ 0.003110] gran_size: 1G chunk_size: 2G num_reg: 4 lose cover RAM: 942M
Jul 20 02:45:56 user-System kernel: [ 0.003111] gran_size: 2G chunk_size: 2G num_reg: 3 lose cover RAM: 1966M
Jul 20 02:45:56 user-System kernel: [ 0.003111] mtrr_cleanup: can not find optimal value
Jul 20 02:45:56 user-System kernel: [ 0.003112] please specify mtrr_gran_size/mtrr_chunk_size
Jul 20 02:45:56 user-System kernel: [ 0.003115] e820: update [mem 0xcb000000-0xffffffff] usable ==> reserved
Jul 20 02:45:56 user-System kernel: [ 0.003118] last_pfn = 0xca000 max_arch_pfn = 0x400000000
Jul 20 02:45:56 user-System kernel: [ 0.010926] found SMP MP-table at [mem 0x000fd850-0x000fd85f]
Jul 20 02:45:56 user-System kernel: [ 0.010959] check: Scanning 1 areas for low memory corruption
Jul 20 02:45:56 user-System kernel: [ 0.010962] reserving inaccessible SNB gfx pages
Jul 20 02:45:56 user-System kernel: [ 0.010967] BRK [0x13a201000, 0x13a201fff] PGTABLE
Jul 20 02:45:56 user-System kernel: [ 0.010969] BRK [0x13a202000, 0x13a202fff] PGTABLE
Jul 20 02:45:56 user-System kernel: [ 0.010970] BRK [0x13a203000, 0x13a203fff] PGTABLE
Jul 20 02:45:56 user-System kernel: [ 0.011022] BRK [0x13a204000, 0x13a204fff] PGTABLE
Jul 20 02:45:56 user-System kernel: [ 0.011023] BRK [0x13a205000, 0x13a205fff] PGTABLE
Jul 20 02:45:56 user-System kernel: [ 0.011312] BRK [0x13a206000, 0x13a206fff] PGTABLE
Jul 20 02:45:56 user-System kernel: [ 0.011322] BRK [0x13a207000, 0x13a207fff] PGTABLE
Jul 20 02:45:56 user-System kernel: [ 0.011332] BRK [0x13a208000, 0x13a208fff] PGTABLE
Jul 20 02:45:56 user-System kernel: [ 0.011408] BRK [0x13a209000, 0x13a209fff] PGTABLE
Jul 20 02:45:56 user-System kernel: [ 0.011499] BRK [0x13a20a000, 0x13a20afff] PGTABLE
Jul 20 02:45:56 user-System kernel: [ 0.011746] BRK [0x13a20b000, 0x13a20bfff] PGTABLE
Jul 20 02:45:56 user-System kernel: [ 0.011858] BRK [0x13a20c000, 0x13a20cfff] PGTABLE
我看到一篇帖子说我必须在 grub 中指定
enable_mtrr_cleanup mtrr_spare_reg_nr=1 mtrr_gran_size=32M mtrr_chunk_size=128M
我应该如何以及为什么指定 mtrr_gran_size/mtrr_chunk_size?
因此,我想知道,如何计算正确的mtrr_gran_size,mtrr_chunk_size值,以及其他参数是否与我的情况相关。如果有人能在这方面给我一些见解,我将不胜感激。