LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tomoki Sekiyama <tomoki.sekiyama.qu@hitachi.com>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Cc: yumiko.sugita.yf@hitachi.com, masami.hiramatsu.pt@hitachi.com,
	yuji.kakutani.uw@hitachi.com, hidehiro.kawai.ez@hitachi.com,
	satoshi.oshima.fk@hitachi.com
Subject: [BUG][PATCH] mm: Fix dirty page accounting per backing_dev
Date: Wed, 07 Feb 2007 19:04:47 +0900	[thread overview]
Message-ID: <45C9A43F.2010401@hitachi.com> (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
104
% 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
105
% 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
107

This patch fixes it.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama.qu@hitachi.com>
---
 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)
 				task_io_account_cancelled_write(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:
  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=45C9A43F.2010401@hitachi.com \
    --to=tomoki.sekiyama.qu@hitachi.com \
    --cc=akpm@linux-foundation.org \
    --cc=hidehiro.kawai.ez@hitachi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=satoshi.oshima.fk@hitachi.com \
    --cc=yuji.kakutani.uw@hitachi.com \
    --cc=yumiko.sugita.yf@hitachi.com \
    --subject='Re: [BUG][PATCH] mm: Fix dirty page accounting per backing_dev' \
    /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

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