QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1690|回复: 7

ULK Memory - Chapter 2 Tip

[复制链接]
发表于 2003-6-1 21:03:17 | 显示全部楼层 |阅读模式
我发现很难写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.
发表于 2003-6-1 23:25:11 | 显示全部楼层
about the super page, there are some patches on web to implement the 2m page under ia kernel. it is believed to be useful for some special purposes. like multimedia server.
回复

使用道具 举报

发表于 2003-6-2 01:02:53 | 显示全部楼层
i check the 2.5.70 just now. it already have super tlb page support now. and dbms can benefit from it. it is claimed to be added to linux kernel from 2.5.3x.
回复

使用道具 举报

 楼主| 发表于 2003-6-2 09:29:00 | 显示全部楼层
喔, 也就是在compile time的时候, 决定是否使用2MByte的页面.
回复

使用道具 举报

发表于 2003-6-2 21:52:08 | 显示全部楼层
i believe a program can use 2mb page and 4kb page at the same time. and the 2mb page is used via different system call.
回复

使用道具 举报

发表于 2003-6-2 22:02:57 | 显示全部楼层
二人转阿二人转阿,呵呵
因为工作忙没时间看,既然二位老大看了能不能回答我几个问题

1。大页面我没觉得有什么,也就是硬件支持不同的页屏蔽位而已(我觉得),不知道linux可不可以支持4gb以上的内存,能支持的话怎么支持的

2。好像其中有人读过FreeBSD的源代码,好像FreeBSD使用的是mach内核的方法,不知道Linux与他有什么不同,哪个好?
回复

使用道具 举报

发表于 2003-6-2 22:24:57 | 显示全部楼层
for the ram size > 4gb , pls read 2.5.5.4 Final kernel Page Table when RAM size is more than 4096 MB


the purpose we two jump up and down here is to encourage more and more people get involved.  
回复

使用道具 举报

 楼主| 发表于 2003-6-3 08:50:26 | 显示全部楼层
1。大页面我没觉得有什么,也就是硬件支持不同的页屏蔽位而已(我觉得),不知道linux可不可以支持4gb以上的内存,能支持的话怎么支持的

支持的, 你可以参考ULK2关于ZONE_HIGHMEM方面的描述。简而言之,虽然OS支持的最大内存尺寸是64GB,但是OS里任何一个进程还是最多只能访问4GB的空间,包括内核。
2。好像其中有人读过FreeBSD的源代码,好像FreeBSD使用的是mach内核的方法,不知道Linux与他有什么不同,哪个好?

FreeBSD的成功之处,其一就是它的VM非常的高效,它来源Mach,但是改变了很多,优化了很多。具体我也没有真正把握,感觉资料太少,我只是对内核内存管理做过分析,可以在bbs.wtwh.edu.cn上找到。Matthew Dillon,现在FreeBSD VM的主要工作者。你可以搜索....
http://www.daemonnews.org/200001/freebsd_vm.html
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-23 06:02 , Processed in 0.071254 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表