- 论坛徽章:
- 16
|
请教了kouu和某位VM大神,总结如下:
1. it says"If the low watermark(per_cpu_pageset->low) has not been reached, the pages will be allocated from the pageset with no requirement for a spinlock to be hold"。
那么是否引入per_cpu_pages的目的就是可以省去使用spin_lock_irqsave,spin_unlock_irqsave这对自旋锁?这对自旋锁是干什么用的?省去了会带来什么好处?
1)由于buddy system各个CPU都需要使用,会产生竞争,所以加锁,而per_cpu_pages是 per CPU的,不需要加锁
2)提高本地cache命中率,per_cpu_pages使得内存在倾向于在同一个CPU上使用
2. it says"With 0 order allocations, splits will be delayed until the low watermark is reached in the per-cpu set, and coalescing will be delayed until the high watermark is reached"
为什么使用per_cpu_pages分配会产生延迟还是不明白?
由于分配order为1的页是比较容易的,如果早早就split,造成碎片的可能性就大一些!
3. it says"The first issue is that high-order allocations may fail if the pagesets hold order-0 pages that would normally be merged into higher order contigous blocks"
也就是说per_cpu_pages占用了一些page,使page都是order 0,无法合并成大的order,这样请求大order的block就会失败,这个问题是怎么解决的?
当页面不足的时候,per_cpu_pages的页会被回收回来,如drain_pages之类的函数
4. it says"The last potential problem is that buddies of newly freed pages could exist in other pagesets, leading to possible fragmentation problems"
不了解这种potential problem什么情况下会产生,为什么还会导致fragmentation problems?
也就是说可能组成兄弟的两个page块一个在buddy里,一个在per_cpu_pages里,这样就不能组成一个大的order了 |
|