博文

目前显示的是 八月, 2012的博文

认识Linux/ARM 中的冷热页

Agenda 1. 何谓冷热页? 2. 冷热页到底起到什么作用? 3. 多大的冷热页最合适? 4. 在Linux / ARM中如何维护冷热页? 4.1 初始化 4.2 怎样增加冷热页库存 4.3 怎样分配冷热页 1. 何谓冷热页? 在Linux Kernel的物理内存管理的buddy system中,引入了冷热页的概念。冷页表示该空闲页已经不再高速缓存中了 ( 一般是指L2 Cache ) ,热页表示该空闲页仍然在高速缓存中。冷热页是针对于每CPU的,每个zone中,都会针对于所有的CPU初始化一个冷热页的per - cpu - pageset . 2. 冷热页到底起到什么积极作用? 作用有3点: 2.1 ). Buddy Allocator在分配order为0的空闲页的时候,如果分配一个热页,那么由于该页已经存在于L2 Cache中了。CPU写访问的时候,不需要先把内存中的内容读到Cache中,然后再写。如果分配一个冷页,说明该页不在L2 Cache中。一般情况下,尽可能用热页,是容易理解的。什么时候用冷页呢?While allocating a physical page frame , there is a bit specifying whether we would like a hot or a cold page ( that is , a page likely to be in the CPU cache , or a page not likely to be there ). If the page will be used by the CPU , a hot page will be faster . If the page will be used for device DMA the CPU cache would be invalidated anyway , and a cold page does not waste precious cache conten