創作共用-姓名 標示-非商業性-相同方式分享
CC-BY-NC-SA
中正大學 –羅習五 74
增加page size(frame size)
增加page size是個好主意,但page size越大,軟體在管理上的
彈性就越小(這下一個章節virtual memory會討論)
各種處理器幾乎都有「huge page的選項」
X86-64為例,有下列選項
4K, 2M and 1G (or 64K and 512M if one builds their own kernel with
CONFIG_ARM64_64K_PAGES=y)
Linux可以使用mmap配置記憶體,具有「MAP_HUGETLB」選
項
創作共用-姓名 標示-非商業性-相同方式分享
CC-BY-NC-SA
中正大學 –羅習五 107
TLB Miss的軟體解決方法
MIPS處理器使用了software-managed TLB,當TLB miss時將觸
發exception將由OS kernel進行後續處理
Three types of TLB exceptions can occur:
TLB Refill occurs when there is no TLB entry that matches an
attempted reference to a mapped address space.
TLB Invalid occurs when a virtual address reference matches a TLB
entry that is marked invalid.
TLB Modified occurs when a store operation virtual address reference
to memory matches a TLB entry which is marked valid but is not dirty
(the entry is not writable).
https://www.manualslib.com/manual/596187/Mips-Technologies-R4000.html?page=158#manual
創作共用-姓名 標示-非商業性-相同方式分享
CC-BY-NC-SA
中正大學 –羅習五 130
Slab Allocator (注意,恐龍本有slab)
When cache created, filled with objects marked as free
When structures stored, objects marked as used
If slab is full of used objects, next object allocated from empty
slab
If no empty slabs, new slab allocated
Benefits include no fragmentation, fast memory request
satisfaction
創作共用-姓名 標示-非商業性-相同方式分享
CC-BY-NC-SA
中正大學 –羅習五 134
Slab Allocation
used
used
used
used
used
used
used
used
kmem_
cache
(16B)
kmem_
cache
(32B)
kmem_
cache
(64B)
slab
full
135.
創作共用-姓名 標示-非商業性-相同方式分享
CC-BY-NC-SA
中正大學 –羅習五 135
Slab Allocation
used
used
used
used
used
used
used
used
kmem_
cache
(16B)
used
used
used
used
slab
full
slab
partial
slab
free