I use cachestat (enable debug flag) to test iozone O_SYNC write、re-write,
After write mode finish and then test re-write mode , mark_page_accessed(mpa) 、add_to_page_cache_lru(apci) count are very low,
Cause the formula calculation of hitratio、miss and hit count equal to 0
If test iozone O_SYNC+O_DIRECT or O_DIRECT, it can't happen this problem.
And then i check write、re-write behavior difference, write mode satisfy below judgement to sync revised data to inode , finally can access mark_page_accessed(mpa) lead to mpa counts too high, but re-write mode can't happen this action.
void __mark_inode_dirty(struct inode *inode, int flags){
--
[...]
if (flags & (I_DIRTY_SYNC \| I_DIRTY_DATASYNC \| I_DIRTY_TIME)) {
trace_writeback_dirty_inode_start(inode, flags);
if (sb->s_op->dirty_inode)
sb->s_op->dirty_inode(inode, flags); // ext4_dirty_inode()
trace_writeback_dirty_inode(inode, flags);
}
add_to_page_cache_lru(apci) load new page to cache in write mode , but in re-mode case it can't access this function because already find page in page cache, the apci almost equal to 0.
So I have question how to make re-write mode hitratio have reference value when dirty page exist in page cache and not sync to inode, it can compute page cache access situation as much as possible, not make formula calculation happen strange exception (total=miss=hit=0).
I am not a kernel page cache expert. @brendangregg What do you think the issue @KenWUs brought up here? Do we need to bring here some page cache expert?
Hi all,
I use cachestat (enable debug flag) to test iozone O_SYNC write、re-write, After write mode finish and then test re-write mode , mark_page_accessed(mpa) 、add_to_page_cache_lru(apci) count are very low, Cause the formula calculation of hitratio、miss and hit count equal to 0 If test iozone O_SYNC+O_DIRECT or O_DIRECT, it can't happen this problem.
And then i check write、re-write behavior difference, write mode satisfy below judgement to sync revised data to inode , finally can access mark_page_accessed(mpa) lead to mpa counts too high, but re-write mode can't happen this action.
ftrace
add_to_page_cache_lru(apci) load new page to cache in write mode , but in re-mode case it can't access this function because already find page in page cache, the apci almost equal to 0.
So I have question how to make re-write mode hitratio have reference value when dirty page exist in page cache and not sync to inode, it can compute page cache access situation as much as possible, not make formula calculation happen strange exception (total=miss=hit=0).