From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail143.messagelabs.com (mail143.messagelabs.com [216.82.254.35]) by kanga.kvack.org (Postfix) with ESMTP id 837F28D003B for ; Fri, 22 Apr 2011 17:23:05 -0400 (EDT) Date: Fri, 22 Apr 2011 23:23:00 +0200 From: Jan Kara Subject: Re: [PATCH 5/6] writeback: try more writeback as long as something was written Message-ID: <20110422212300.GC2977@quack.suse.cz> References: <20110419102016.GD5257@quack.suse.cz> <20110419111601.GA18961@localhost> <20110419211008.GD9556@quack.suse.cz> <20110420075053.GB30672@localhost> <20110420152211.GC4991@quack.suse.cz> <20110421033325.GA13764@localhost> <20110421043940.GC22423@infradead.org> <20110421060556.GA24232@localhost> <20110421164154.GC4476@quack.suse.cz> <20110422023226.GB6199@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110422023226.GB6199@localhost> Sender: owner-linux-mm@kvack.org List-ID: To: Wu Fengguang Cc: Jan Kara , Christoph Hellwig , Andrew Morton , Mel Gorman , Dave Chinner , Trond Myklebust , Itaru Kitayama , Minchan Kim , LKML , "linux-fsdevel@vger.kernel.org" , Linux Memory Management List On Fri 22-04-11 10:32:26, Wu Fengguang wrote: > On Fri, Apr 22, 2011 at 12:41:54AM +0800, Jan Kara wrote: > > On Thu 21-04-11 14:05:56, Wu Fengguang wrote: > > > On Thu, Apr 21, 2011 at 12:39:40PM +0800, Christoph Hellwig wrote: > > > > On Thu, Apr 21, 2011 at 11:33:25AM +0800, Wu Fengguang wrote: > > > > > I collected the writeback_single_inode() traces (patch attached for > > > > > your reference) each for several test runs, and find much more > > > > > I_DIRTY_PAGES after patchset. Dave, do you know why there are so many > > > > > I_DIRTY_PAGES (or radix tag) remained after the XFS ->writepages() call, > > > > > even for small files? > > > > > > > > What is your defintion of a small file? As soon as it has multiple > > > > extents or holes there's absolutely no way to clean it with a single > > > > writepage call. > > > > > > It's writing a kernel source tree to XFS. You can find in the below > > > trace that it often leaves more dirty pages behind (indicated by the > > > I_DIRTY_PAGES flag) after writing as less as 1 page (indicated by the > > > wrote=1 field). > > As Dave said, it's probably just a race since XFS redirties the inode on > > IO completion. So I think the inodes are just small so they have only a few > > dirty pages so you don't have much to write and they are written and > > redirtied before you check the I_DIRTY flags. You could use radix tree > > dirty tag to verify whether there are really dirty pages or not... > > Yeah, Dave and Christoph root caused it in the other email -- XFS sets > I_DIRTY which accidentally sets I_DIRTY_PAGES. We can safely bet there > are no real dirty pages -- otherwise it would have turned up as > performance regressions. Yes, but then the question what we actually do better is still open, right? :) I'm really curious what it could be because especially in your copy-kernel case I should not make much different - maybe except if we occasionally managed to block on PageLock behind the writing thread and now we don't because we queue the inode later but I find that highly unlikely. > > BTW a quick check of kernel tree shows the following distribution of > > sizes (in KB): > > Count KB Cumulative Percent > > 257 0 0.9% > > 13309 4 45% > > 5553 8 63% > > 2997 12 73% > > 1879 16 80% > > 1275 20 83% > > 987 24 87% > > 685 28 89% > > 540 32 91% > > 387 36 ... > > 309 40 > > 264 44 > > 249 48 > > 170 52 > > 143 56 > > 144 60 > > 132 64 > > 100 68 > > ... > > Total 30155 > > > > And the distribution of your 'wrote=xxx' roughly corresponds to this... > > Nice numbers! How do you manage to account them? :) Easy shell command (and I handcomputed the percentages because I was lazy to write a script for that): find . -type f -name "*.[ch]" -exec du {} \; | cut -d ' ' -f 1 | sort -n | uniq -c Honza -- Jan Kara SUSE Labs, CR -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org