Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754005AbbDMMVS (ORCPT ); Mon, 13 Apr 2015 08:21:18 -0400 Received: from cantor2.suse.de ([195.135.220.15]:38381 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751455AbbDMMVQ (ORCPT ); Mon, 13 Apr 2015 08:21:16 -0400 Date: Mon, 13 Apr 2015 14:21:10 +0200 From: Jan Kara To: Boaz Harrosh Cc: Zhao Lei , "'Christoph Hellwig'" , linux-fsdevel@vger.kernel.org, "'Jan Kara'" , "'Jens Axboe'" , "'LKML'" Subject: Re: Regression caused by using node_to_bdi() Message-ID: <20150413122110.GE3633@quack.suse.cz> References: <016d01d07380$fc37fc40$f4a7f4c0$@cn.fujitsu.com> <552A57F8.7020002@plexistor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <552A57F8.7020002@plexistor.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3035 Lines: 95 On Sun 12-04-15 14:33:12, Boaz Harrosh wrote: > On 04/10/2015 02:25 PM, Zhao Lei wrote: > > Hi, Christoph Hellwig > > > > resend: + cc lkml, linux-fsdevel > > > > Since there is no response for my last mail, I worry that some problem in > > the mail system, please allow me to resend it. > > > > I found regression in v4.0-rc1 caused by this patch: > > Author: Christoph Hellwig > > Date: Wed Jan 14 10:42:36 2015 +0100 > > fs: export inode_to_bdi and use it in favor of mapping->backing_dev_info > > > <> > > Result is following: > > v3.19-rc1: testcnt=40 average=135.677 range=[132.460,139.130] stdev=1.610 cv=1.19% > > v4.0-rc1: testcnt=40 average=130.970 range=[127.980,132.050] stdev=1.012 cv=0.77% > > > > Then I bisect above case between v3.19-rc1 and v4.0-rc1, and found > > this patch caused the regresstion. > > > > Maybe it is because kernel need more time to call node_to_bdi(), > > compared with "using inode->i_mapping->backing_dev_info directly" in > > old code. > > > > Is there some way to speed up it(inline, or some access some variant > > in struct directly, ...)? > > > > Christoph hi > > Both node_to_bdi() and sb_is_blkdev_sb() > (and I_BDEV() && blk_get_backing_dev_info()) > Are an exported function calls. > > Can we not make blockdev_superblock->s_bdi == NULL, > and then optimize-out the call to sb_is_blkdev_sb() to only > that case. Something like: > > --- > > diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c > index 32a8bbd..e0375e1 100644 > --- a/fs/fs-writeback.c > +++ b/fs/fs-writeback.c > @@ -78,7 +78,7 @@ int writeback_in_progress(struct backing_dev_info *bdi) > } > EXPORT_SYMBOL(writeback_in_progress); > > -struct backing_dev_info *inode_to_bdi(struct inode *inode) > +struct backing_dev_info *__inode_to_bdi(struct inode *inode) > { > struct super_block *sb; > > @@ -92,7 +92,7 @@ struct backing_dev_info *inode_to_bdi(struct inode *inode) > #endif > return sb->s_bdi; > } > -EXPORT_SYMBOL_GPL(inode_to_bdi); > +EXPORT_SYMBOL_GPL(__inode_to_bdi); > > static inline struct inode *wb_inode(struct list_head *head) > { > diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h > index aff923a..7d172f5 100644 > --- a/include/linux/backing-dev.h > +++ b/include/linux/backing-dev.h > @@ -107,7 +107,16 @@ struct backing_dev_info { > #endif > }; > > -struct backing_dev_info *inode_to_bdi(struct inode *inode); > +struct backing_dev_info *__inode_to_bdi(struct inode *inode); > + > +static inline > +struct backing_dev_info *inode_to_bdi(struct inode *inode) > +{ > + if (!inode || !inode->i_sb) > + return __inode_to_bdi(inode); > + > + return inode->i_sb->s_bdi; > +} This is wrong for block-device inodes, isn't it? Honza -- Jan Kara SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/