linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Wu Fengguang <fengguang.wu@intel.com>
Cc: linux-fsdevel@vger.kernel.org, Jan Kara <jack@suse.cz>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Christoph Hellwig <hch@lst.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/7] writeback: fix dirtied pages accounting on redirty
Date: Wed, 7 Dec 2011 17:09:08 +0100	[thread overview]
Message-ID: <20111207160908.GK4622@quack.suse.cz> (raw)
In-Reply-To: <20111128140513.401344389@intel.com>

On Mon 28-11-11 21:53:42, Wu Fengguang wrote:
> De-account the accumulative dirty counters on page redirty.
> 
> Page redirties (very common in ext4) will introduce mismatch between
> counters (a) and (b)
> 
> a) NR_DIRTIED, BDI_DIRTIED, tsk->nr_dirtied
> b) NR_WRITTEN, BDI_WRITTEN
> 
> This will introduce systematic errors in balanced_rate and result in
> dirty page position errors (ie. the dirty pages are no longer balanced
> around the global/bdi setpoints).
> 
> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
  You can add:

  Acked-by: Jan Kara <jack@suse.cz>

								Honza
> ---
>  include/linux/writeback.h |    2 ++
>  mm/page-writeback.c       |   19 +++++++++++++++++++
>  2 files changed, 21 insertions(+)
> 
> --- linux-next.orig/mm/page-writeback.c	2011-11-28 21:23:23.000000000 +0800
> +++ linux-next/mm/page-writeback.c	2011-11-28 21:23:24.000000000 +0800
> @@ -1806,6 +1806,24 @@ int __set_page_dirty_nobuffers(struct pa
>  EXPORT_SYMBOL(__set_page_dirty_nobuffers);
>  
>  /*
> + * Call this whenever redirtying a page, to de-account the dirty counters
> + * (NR_DIRTIED, BDI_DIRTIED, tsk->nr_dirtied), so that they match the written
> + * counters (NR_WRITTEN, BDI_WRITTEN) in long term. The mismatches will lead to
> + * systematic errors in balanced_dirty_ratelimit and the dirty pages position
> + * control.
> + */
> +void account_page_redirty(struct page *page)
> +{
> +	struct address_space *mapping = page->mapping;
> +	if (mapping && mapping_cap_account_dirty(mapping)) {
> +		current->nr_dirtied--;
> +		dec_zone_page_state(page, NR_DIRTIED);
> +		dec_bdi_stat(mapping->backing_dev_info, BDI_DIRTIED);
> +	}
> +}
> +EXPORT_SYMBOL(account_page_redirty);
> +
> +/*
>   * When a writepage implementation decides that it doesn't want to write this
>   * page for some reason, it should redirty the locked page via
>   * redirty_page_for_writepage() and it should then unlock the page and return 0
> @@ -1813,6 +1831,7 @@ EXPORT_SYMBOL(__set_page_dirty_nobuffers
>  int redirty_page_for_writepage(struct writeback_control *wbc, struct page *page)
>  {
>  	wbc->pages_skipped++;
> +	account_page_redirty(page);
>  	return __set_page_dirty_nobuffers(page);
>  }
>  EXPORT_SYMBOL(redirty_page_for_writepage);
> --- linux-next.orig/include/linux/writeback.h	2011-11-28 21:23:20.000000000 +0800
> +++ linux-next/include/linux/writeback.h	2011-11-28 21:23:24.000000000 +0800
> @@ -197,6 +197,8 @@ void writeback_set_ratelimit(void);
>  void tag_pages_for_writeback(struct address_space *mapping,
>  			     pgoff_t start, pgoff_t end);
>  
> +void account_page_redirty(struct page *page);
> +
>  /* pdflush.c */
>  extern int nr_pdflush_threads;	/* Global so it can be exported to sysctl
>  				   read-only. */
> 
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2011-12-07 16:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-28 13:53 [PATCH 0/7] dirty throttling bits for 3.3 (v2) Wu Fengguang
2011-11-28 13:53 ` [PATCH 1/7] writeback: balanced_rate cannot exceed write bandwidth Wu Fengguang
2011-12-07 10:21   ` Jan Kara
2011-11-28 13:53 ` [PATCH 2/7] writeback: charge leaked page dirties to active tasks Wu Fengguang
2011-12-07 10:23   ` Jan Kara
2011-11-28 13:53 ` [PATCH 3/7] writeback: fix dirtied pages accounting on sub-page writes Wu Fengguang
2011-12-07 10:53   ` Jan Kara
2011-12-07 12:08     ` Wu Fengguang
2011-12-07 16:07       ` Jan Kara
2011-12-08  2:44         ` Wu Fengguang
2011-11-28 13:53 ` [PATCH 4/7] writeback: fix dirtied pages accounting on redirty Wu Fengguang
2011-12-07 16:09   ` Jan Kara [this message]
2011-11-28 13:53 ` [PATCH 5/7] btrfs: fix dirtied pages accounting on sub-page writes Wu Fengguang
2011-11-28 14:16   ` Wu Fengguang
2011-11-28 13:53 ` [PATCH 6/7] writeback: dirty ratelimit - think time compensation Wu Fengguang
2011-12-07 16:14   ` Jan Kara
2011-11-28 13:53 ` [PATCH 7/7] writeback: comment on the bdi dirty threshold Wu Fengguang
2011-12-07 10:57   ` Jan Kara

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=20111207160908.GK4622@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).