linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	miklos@szeredi.hu, neilb@suse.de, dgc@sgi.com,
	tomoki.sekiyama.qu@hitachi.com, nikita@clusterfs.com,
	trond.myklebust@fys.uio.no, yingchao.zhou@gmail.com
Subject: Re: [PATCH 08/10] mm: count writeback pages per BDI
Date: Sun, 22 Apr 2007 00:19:49 -0700	[thread overview]
Message-ID: <20070422001949.4d697fe5.akpm@linux-foundation.org> (raw)
In-Reply-To: <1177153636.2934.43.camel@lappy>

On Sat, 21 Apr 2007 13:07:16 +0200 Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> On Sat, 2007-04-21 at 02:55 -0700, Andrew Morton wrote:
> > On Fri, 20 Apr 2007 17:52:02 +0200 Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> > 
> > > Count per BDI writeback pages.
> > > 
> > > Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > > ---
> > >  include/linux/backing-dev.h |    1 +
> > >  mm/page-writeback.c         |   12 ++++++++++--
> > >  2 files changed, 11 insertions(+), 2 deletions(-)
> > > 
> > > Index: linux-2.6/mm/page-writeback.c
> > > ===================================================================
> > > --- linux-2.6.orig/mm/page-writeback.c	2007-04-20 15:27:28.000000000 +0200
> > > +++ linux-2.6/mm/page-writeback.c	2007-04-20 15:28:10.000000000 +0200
> > > @@ -979,14 +979,18 @@ int test_clear_page_writeback(struct pag
> > >  	int ret;
> > >  
> > >  	if (mapping) {
> > > +		struct backing_dev_info *bdi = mapping->backing_dev_info;
> > >  		unsigned long flags;
> > >  
> > >  		write_lock_irqsave(&mapping->tree_lock, flags);
> > >  		ret = TestClearPageWriteback(page);
> > > -		if (ret)
> > > +		if (ret) {
> > >  			radix_tree_tag_clear(&mapping->page_tree,
> > >  						page_index(page),
> > >  						PAGECACHE_TAG_WRITEBACK);
> > > +			if (bdi_cap_writeback_dirty(bdi))
> > > +				__dec_bdi_stat(bdi, BDI_WRITEBACK);
> > 
> > Why do we test bdi_cap_writeback_dirty() here?
> > 
> > If we remove that test, we end up accumulating statistics for
> > non-writebackable backing devs, but does that matter? 
> 
> It would not, had I not cheated:
> 
> +void bdi_init(struct backing_dev_info *bdi)
> +{
> +       int i;
> +
> +       if (!(bdi_cap_writeback_dirty(bdi) || bdi_cap_account_dirty(bdi)))
> +               return;
> +
> +       for (i = 0; i < NR_BDI_STAT_ITEMS; i++)
> +               percpu_counter_init(&bdi->bdi_stat[i], 0);
> +}
> +EXPORT_SYMBOL(bdi_init);
> 
> >  Probably the common
> > case is writebackable backing-devs, so eliminating the test-n-branch might
> > be a net microgain.
> 
> Time vs space. Now we don't even have storage for those BDIs..
> 
> Don't particularly care on this point though, I just thought it might be
> worthwhile to save on the percpu data.

It could be that we never call test_clear_page_writeback() against
!bdi_cap_writeback_dirty() pages anwyay.  I can't think why we would, but
the relationships there aren't very clear.  Does "don't account for dirty
memory" imply "doesn't ever do writeback"?  One would need to check, and
it's perhaps a bit fragile.

It's worth checking though.  Boy we're doing a lot of stuff in there
nowadays.

OT: it might be worth looking into batching this work up - the predominant
caller should be mpage_end_io_write(), and he has a whole bunch of pages
which are usually all from the same file, all contiguous.  It's pretty
inefficient to be handling that data one-page-at-a-time, and some
significant speedups may be available.

Instead, everyone seems to think that variable pagecache page size is the
only way of improving things.  Shudder.

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-04-22  7:19 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20 15:51 [PATCH 00/10] per device dirty throttling -v5 Peter Zijlstra
2007-04-20 15:51 ` [PATCH 01/10] revert per-backing_dev-dirty-and-writeback-page-accounting Peter Zijlstra
2007-04-20 15:51 ` [PATCH 02/10] nfs: remove congestion_end() Peter Zijlstra
2007-04-20 15:51 ` [PATCH 03/10] lib: dampen the percpu_counter FBC_BATCH Peter Zijlstra
2007-04-21  9:55   ` Andrew Morton
2007-04-21 10:58     ` Peter Zijlstra
2007-04-20 15:51 ` [PATCH 04/10] lib: percpu_counter_mod64 Peter Zijlstra
2007-04-21  9:55   ` Andrew Morton
2007-04-21 11:02     ` Peter Zijlstra
2007-04-21 19:21       ` Andrew Morton
2007-04-21 19:30         ` Peter Zijlstra
2007-04-20 15:51 ` [PATCH 05/10] mm: bdi init hooks Peter Zijlstra
2007-04-20 15:52 ` [PATCH 06/10] mm: scalable bdi statistics counters Peter Zijlstra
2007-04-20 15:52 ` [PATCH 07/10] mm: count reclaimable pages per BDI Peter Zijlstra
2007-04-21  9:55   ` Andrew Morton
2007-04-21 11:04     ` Peter Zijlstra
2007-04-20 15:52 ` [PATCH 08/10] mm: count writeback " Peter Zijlstra
2007-04-21  9:55   ` Andrew Morton
2007-04-21 11:07     ` Peter Zijlstra
2007-04-22  7:19       ` Andrew Morton [this message]
2007-04-22  9:08         ` Peter Zijlstra
2007-04-20 15:52 ` [PATCH 09/10] mm: expose BDI statistics in sysfs Peter Zijlstra
2007-04-21  9:55   ` Andrew Morton
2007-04-21 11:08     ` Peter Zijlstra
2007-04-20 15:52 ` [PATCH 10/10] mm: per device dirty threshold Peter Zijlstra
2007-04-21  9:55   ` Andrew Morton
2007-04-21 10:38     ` Miklos Szeredi
2007-04-21 10:54       ` Andrew Morton
2007-04-21 20:25         ` Miklos Szeredi
2007-04-23  6:14           ` Peter Zijlstra
2007-04-23  6:29             ` Miklos Szeredi
2007-04-23  6:39               ` Andrew Morton
2007-04-21 12:01     ` Peter Zijlstra
2007-04-21 12:15       ` Peter Zijlstra
2007-04-21 19:50         ` Peter Zijlstra
2007-04-23 15:48         ` Christoph Lameter
2007-04-23 15:58           ` Peter Zijlstra
2007-04-23 16:08             ` Christoph Lameter
2007-04-22  7:26       ` Andrew Morton
2007-04-24  2:58   ` Neil Brown
2007-04-24  7:09     ` Peter Zijlstra
2007-04-24  8:19       ` Miklos Szeredi
2007-04-24  8:31         ` Peter Zijlstra
2007-04-24  9:14           ` Miklos Szeredi
2007-04-24  9:26             ` Peter Zijlstra
2007-04-24  9:47               ` Miklos Szeredi
2007-04-24 10:00                 ` Andrew Morton
2007-04-24 10:12                   ` Peter Zijlstra
2007-04-24 10:19                     ` Miklos Szeredi
2007-04-24 10:24                       ` Peter Zijlstra
2007-04-24 10:40                     ` Andrew Morton
2007-04-24 11:22                       ` Miklos Szeredi
2007-04-24 11:50                         ` Andrew Morton
2007-04-24 12:07                           ` Miklos Szeredi
2007-04-22  9:57 ` [PATCH 00/10] per device dirty throttling -v5 Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070422001949.4d697fe5.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=dgc@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=miklos@szeredi.hu \
    --cc=neilb@suse.de \
    --cc=nikita@clusterfs.com \
    --cc=tomoki.sekiyama.qu@hitachi.com \
    --cc=trond.myklebust@fys.uio.no \
    --cc=yingchao.zhou@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox