LKML Archive on
help / color / mirror / Atom feed
From: Tomoki Sekiyama <>
Subject: [BUG][PATCH] mm: Fix dirty page accounting per backing_dev
Date: Wed, 07 Feb 2007 19:04:47 +0900	[thread overview]
Message-ID: <> (raw)

Hello Andrew,

I found a suspicious bug of I/O accounting in 2.6.20-rc6-mm3.
The number of dirty pages per backing_dev available from
/sys/block/<dev>/queue/nr_dirty keeps growing when a file is
rapidly overwritten several times.

For example:
% cat /sys/block/sda/queue/nr_dirty
% for i in 1 2; do dd if=/dev/zero of=dummy bs=4096 count=1; done; sync
% cat /sys/block/sda/queue/nr_dirty
% for i in 1 2 3; do dd if=/dev/zero of=dummy bs=4096 count=1; done; sync
% cat /sys/block/sda/queue/nr_dirty

This patch fixes it.

Signed-off-by: Tomoki Sekiyama <>
 mm/truncate.c |    1 +
 1 file changed, 1 insertion(+)

Index: linux-2.6.20-rc6-mm3/mm/truncate.c
--- linux-2.6.20-rc6-mm3.orig/mm/truncate.c
+++ linux-2.6.20-rc6-mm3/mm/truncate.c
@@ -70,6 +70,7 @@ void cancel_dirty_page(struct page *page
 	if (TestClearPageDirty(page)) {
 		struct address_space *mapping = page->mapping;
 		if (mapping && mapping_cap_account_dirty(mapping)) {
+			atomic_long_dec(&mapping->backing_dev_info->nr_dirty);
 			dec_zone_page_state(page, NR_FILE_DIRTY);
 			if (account_size)

                 reply	other threads:[~2007-02-07 10:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \
    --subject='Re: [BUG][PATCH] mm: Fix dirty page accounting per backing_dev' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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