xfs_buf and buffercache/pagecache connection
Hello,
I was looking to add a kernel hook to my system in order to
monitor buffer-cache hit and misses. Initially I was
planning to add my modifications to the __getblk(). However, i noticed that XFS does not directly use the buffer-cache for its pages but it seems to implement its own buffer.
What I am now looking for is 1) the place where XFS checks
whether a page exists in its buffer or not and 2)
what are the possible interactions between xfs_buf and the Linux kernel buffer-cache.
I would appreciate any information regarding the above issues.
Thanks in advance,
Yannis Klonatos
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 10 lines · Yannis Klonatos
I was looking to add a kernel hook to my system in order to
monitor buffer-cache hit and misses. Initially I was planning to add my modifications to the__getblk(). However, i noticed that XFS does not directly use the buffer-cache
for its pages but it seems to implement its own buffer.
What I am now looking for is 1) the place where XFS checks
whether a page exists in its buffer or not and 2)
what are the possible interactions betweenxfs_bufand the Linux kernel buffer-cache.
I would appreciate any information regarding the above issues.
The kernel does not track all accesses, e.g. through mmap. So you can only get misses (which is essentially IO rate and already accounted), but not hits.
-Andi
Signature · 6 lines
[email protected] -- Speaking for myself only. _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
???? 5/31/2010 9:04 PM, O/H Andi Kleen ??????:
Quoted 14 lines
Quoted 11 lines · Yannis Klonatos
I was looking to add a kernel hook to my system in order to
monitor buffer-cache hit and misses. Initially I was planning to add my modifications to the__getblk(). However, i noticed that XFS does not directly use the buffer-cache
for its pages but it seems to implement its own buffer.
What I am now looking for is 1) the place where XFS checks
whether a page exists in its buffer or not and 2)
what are the possible interactions betweenxfs_bufand the Linux kernel buffer-cache.
I would appreciate any information regarding the above issues.
Quoted 6 lines
The kernel does not track all accesses, e.g. through mmap. So you can only get misses (which is essentially IO rate and already accounted), but not hits.
-Andi
First of all thanks for your quick reply.
So, if i understand correctly, what you are saying is that it is basically impossible to modify xfs code so that i get that specific information? This sounds a bit strange since if XFS was indeed using the buffercache as ext3 or other fs does, the following modification would suffice (file fs/buffer.c):
structbuffer_head <+code=buffer_head> *find_get_block <+code=__find_get_block>(structblock_device <+code=block_device> *bdev <+code=bdev>,sector_t <+code=sector_t> block <+code=block>, intsize <+code=size>) {
structbuffer_head <+code=buffer_head> *bh <+code=bh> =lookup_bh_lru <+code=lookup_bh_lru>(bdev <+code=bdev>,block <+code=block>,size <+code=size>);
/* BEGIN MODIFICATION */
if (bh) buffercache_hits++;
else buffercache_misses++;
/* END MODIFICATION */
if (bh <+code=bh> ==NULL <+code=NULL>) {
bh <+code=bh> =__find_get_block_slow <+code=__find_get_block_slow>(bdev <+code=bdev>,block <+code=block>);
if (bh <+code=bh>)
bh_lru_install <+code=bh_lru_install>(bh <+code=bh>);
}
if (bh <+code=bh>) {
touch_buffer <+code=touch_buffer>(bh <+code=bh>);
returnbh <+code=bh>;}
XPORT_SYMBOL <+code=EXPORT_SYMBOL>(__find_get_block <+code=__find_get_block>);
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 12 lines · Yannis Klonatos
Hello,
I was looking to add a kernel hook to my system in order to
monitor buffer-cache hit and misses. Initially I was planning to add my modifications to the__getblk(). However, i noticed that XFS does not directly use the buffer-cache
for its pages but it seems to implement its own buffer.
What I am now looking for is 1) the place where XFS checks
whether a page exists in its buffer or not and 2)
what are the possible interactions betweenxfs_bufand the Linux kernel buffer-cache.
I would appreciate any information regarding the above issues.
There are already stats in place to tell you about this.
http://xfs.org/index.php/Runtime_Stats#buf_-_Buf_Statistics
They aren't documented there, but if you look at fs/xfs/linux-2.6/xfs_buf.c an search for XFS_STATS_INC you'll find what they all mean from the code. It isn't as simple as hit or miss counters - there's different counters for different types of hits and misses....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs