linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: richard kennedy <richard@rsk.demon.co.uk>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] balance_dirty_pages - exit loop when no more pages available
Date: Tue, 31 Jul 2007 18:11:30 +0100	[thread overview]
Message-ID: <1185901890.3133.33.camel@castor.rsk.org> (raw)

exit loop in balance_dirty_pages when no more pages available to write

On a bdi that has very little traffic balance_dirty_pages can loop
needlessly waiting until do_writepages has written enough pages.

do_writepages will return encountered_congestion==0 && nr_to_write > 0 
when it has completed a pass but did not find enough pages available to
write. balance_dirty_pages ignores this and keeps looping until a total
of chunk pages was written. 

this patch adds an extra exit condition to break out of the loop in this
case. 

I've tested this on my amd64 desktop, and I also have a version of this
patch that includes a printk and a test case that occasionally does
trigger this condition.  

Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>

------
--- linux-2.6.22.1/mm/page-writeback.c.orig	2007-07-30 16:36:09.000000000 +0100
+++ linux-2.6.22.1/mm/page-writeback.c	2007-07-31 16:26:43.000000000 +0100
@@ -250,6 +250,8 @@ static void balance_dirty_pages(struct a
 			pages_written += write_chunk - wbc.nr_to_write;
 			if (pages_written >= write_chunk)
 				break;		/* We've done our duty */
+			if (!wbc.encountered_congestion && wbc.nr_to_write > 0)
+				break;	/* didn't find enough to do */
 		}
 		congestion_wait(WRITE, HZ/10);
 	}


--
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-07-31 17:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-31 17:11 richard kennedy [this message]
2007-08-02 19:54 ` Chuck Ebbert

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=1185901890.3133.33.camel@castor.rsk.org \
    --to=richard@rsk.demon.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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