|
我发现很难写Notes,因为ULK写得太好了,自己水平也有限。我在内存管理部分,第二章的后面部分涉及到很多第七章的内容,我还没看。我写了四个Notes。
Note 1:cs的另一个功能
The cs register has another important function: it includes a 2-bit field that specifies the Current Privilege Level (CPL) of the CPU.
Note 2:ss在从User Mode切换到Kernel Mode时的指向
本来在User Mode下,ss指向用户态的堆栈。When switching from User Mode to Kernel Mode, Linux always makes sure that the ss register contains the Segment Selector of the kernel data segment.
Note 3:Linux PAE机制下三级分页与Intel的PAE机制对应关系
However, when Linux uses the Physical Address Extension (PAE) mechanism of the Pentium Pro and later processors, the Linux's Page Global Directory corresponds to the 80 x 86's Page Directory Pointer Table, the Page Middle Directory to the 80 x 86's Page Directory, and the Linux's Page Table to the 80 x 86's Page Table.
关于Intel PAE机制根据页面大小不同共有两种策略:4-Kbyte Pages & 2-Mbyte Pages。[Intel] Linux采用了前者来实现。详细参考Intel手册第三卷(2003)。
Note 4:Linux2.4.20的快速页面分配的实现
书中说“Linux 2.4.18 already includes some functions and data structures, such as pte_quicklist or pgd_quicklist, to implement such cache; however, the code is not mature and the cache is not used yet.”但是,Linux2.4.20已经真正开始使用了。主要参考代码集中在/include/asm-i386/pgalloc.h。
Broadly speaking, the three implement caching with the use of three caches called pgd_quicklist, pmd_quicklist and pte_quicklist. Architectures implement these three lists in different ways but one method is through the use of a LIFO type structure. Ordinarily, a page table entry contains points to other pages containing page tables or data. While cached, the first element of the list is used to point to the next free page table. During allocation, one page is popped off the list and during free, one is placed as the new head of the list. A count is kept of how many pages are used in the cache.
The quick allocation function from the pgd_quicklist is not externally defined outside of the architecture although get_pgd_fast() is a common choice for the function name. The cached allocation function for PMDs and PTEs are publicly defined as pmd_alloc_one_fast() and pte_alloc_one_fast().
If a page is not available from the cache, a page will be allocated using the physical page allocator (see Chapter 7). The functions for the three levels of page tables are get_pgd_slow(), pmd_alloc_one() and pte_alloc_one(). [Mel Gorman]
[Mel Gorman] Mel Gorman “Understanding The Linux Virtual Memory Manager” 19th May 2003.
[Intel] Intel“Architecture Software Developer’s Manual Volume 3”2003. |
|