由于页面存储在每个inode内的address_space中,后台页面缓存刷新线程如何知道所有脏页?
答案 0 :(得分:2)
他们都在一个place:
struct bdi_writeback {
struct backing_dev_info *bdi; /* our parent bdi */
unsigned int nr;
unsigned long last_old_flush; /* last old data flush */
unsigned long last_active; /* last time bdi thread was active */
struct task_struct *task; /* writeback thread */
struct timer_list wakeup_timer; /* used for delayed bdi thread wakeup */
struct list_head b_dirty; /* dirty inodes */
struct list_head b_io; /* parked for writeback */
struct list_head b_more_io; /* parked for more writeback */
spinlock_t list_lock; /* protects the b_* lists */
};
b_dirty
是您要查找的列表。
有关如何发生冲洗的一些信息,请查看in here。但代码有点复杂。总结(很多),考虑在默认配置中写入磁盘的数据将位于内存中,直到a)它们超过30秒,或者b)脏页消耗了超过10%的活动,工作记忆。
答案 1 :(得分:1)
在x86平台上,操作系统必须检查其page table entries
以查找脏页。在内存写入期间,CPU会自动设置一个特殊的dirty
位。必须有一些代码可以扫描PTEs
dirty
= 1。