From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cuda.sgi.com (cuda1.sgi.com [192.48.157.11]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id o4VINhA1191965 for ; Mon, 31 May 2010 13:23:44 -0500 Received: from mailgate.ics.forth.gr (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id 9BBF0158070F for ; Mon, 31 May 2010 11:28:22 -0700 (PDT) Received: from mailgate.ics.forth.gr (mailgate.ics.forth.gr [139.91.1.2]) by cuda.sgi.com with ESMTP id IKWTkZL28mUxGdK2 for ; Mon, 31 May 2010 11:28:22 -0700 (PDT) Message-ID: <4C03FF19.2070608@ics.forth.gr> Date: Mon, 31 May 2010 21:25:29 +0300 From: Yannis Klonatos MIME-Version: 1.0 Subject: Re: xfs_buf and buffercache/pagecache connection References: <4C03E46B.9040407@ics.forth.gr> <87aargt0ap.fsf@basil.nowhere.org> In-Reply-To: <87aargt0ap.fsf@basil.nowhere.org> List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============0681213002595006153==" Sender: xfs-bounces@oss.sgi.com Errors-To: xfs-bounces@oss.sgi.com To: Andi Kleen Cc: xfs@oss.sgi.com This is a multi-part message in MIME format. --===============0681213002595006153== Content-Type: multipart/alternative; boundary="------------030401060206070607000305" This is a multi-part message in MIME format. --------------030401060206070607000305 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit ???? 5/31/2010 9:04 PM, O/H Andi Kleen ??????: > Yannis Klonatos writes: > > >> 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. >> > 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>); --------------030401060206070607000305 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit στις 5/31/2010 9:04 PM, O/H Andi Kleen έγραψε:
Yannis Klonatos <klonatos@ics.forth.gr> writes:

  
        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.
    
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):

struct buffer_head *
find_get_block(struct block_device *bdev, sector_t block, int size) {

     	struct buffer_head *bh = lookup_bh_lru(bdev, block, size);
	/* BEGIN MODIFICATION */
	if (bh) buffercache_hits++;
	else buffercache_misses++;
	/* END MODIFICATION */
        if (bh == NULL) {
               bh = __find_get_block_slow(bdev, block);
               if (bh)
                       bh_lru_install(bh);
       }
       if (bh) {
               touch_buffer(bh);
       return bh;

}

XPORT_SYMBOL(__find_get_block);

--------------030401060206070607000305-- --===============0681213002595006153== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs --===============0681213002595006153==--