From: "Nate Diller" <nate.diller@gmail.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Hugh Dickins <hugh@veritas.com>, Andrew Morton <akpm@osdl.org>,
David Howells <dhowells@redhat.com>,
Christoph Lameter <christoph@lameter.com>,
Martin Bligh <mbligh@google.com>, Nick Piggin <npiggin@suse.de>,
Linus Torvalds <torvalds@osdl.org>,
Hans Reiser <reiser@namesys.com>,
"E. Gryaznova" <grev@namesys.com>
Subject: [PATCH] mm/tracking dirty pages: update get_dirty_limits for mmap tracking
Date: Wed, 21 Jun 2006 10:01:17 -0700 [thread overview]
Message-ID: <5c49b0ed0606211001s452c080cu3f55103a130b78f1@mail.gmail.com> (raw)
Update write throttling calculations now that we can track and
throttle dirty mmap'd pages. A version of this patch has been tested
with iozone:
http://namesys.com/intbenchmarks/iozone/06.06.19.tracking.dirty.page-noatime_-B/e3-2.6.16-tr.drt.pgs-rt.40_vs_rt.80.html
http://namesys.com/intbenchmarks/iozone/06.06.19.tracking.dirty.page-noatime_-B/r4-2.6.16-tr.drt.pgs-rt.40_vs_rt.80.html
Signed-off-by: Nate Diller <nate.diller@gmail.com>
--- linux-2.6.orig/mm/page-writeback.c 2005-10-27 17:02:08.000000000 -0700
+++ linux-2.6/mm/page-writeback.c 2006-06-21 08:24:11.000000000 -0700
@@ -69,7 +69,7 @@ int dirty_background_ratio = 10;
/*
* The generator of dirty data starts writeback at this percentage
*/
-int vm_dirty_ratio = 40;
+int vm_dirty_ratio = 80;
/*
* The interval between `kupdate'-style writebacks, in centiseconds
@@ -119,15 +119,14 @@ static void get_writeback_state(struct w
* Work out the current dirty-memory clamping and background writeout
* thresholds.
*
- * The main aim here is to lower them aggressively if there is a lot of mapped
- * memory around. To avoid stressing page reclaim with lots of unreclaimable
- * pages. It is better to clamp down on writers than to start swapping, and
- * performing lots of scanning.
- *
- * We only allow 1/2 of the currently-unmapped memory to be dirtied.
- *
- * We don't permit the clamping level to fall below 5% - that is getting rather
- * excessive.
+ * We now have dirty memory accounting for mmap'd pages, so we calculate the
+ * ratios based on the available memory. We still have no way of tracking
+ * how many pages are pinned (eg BSD wired accounting), so we still need the
+ * hard clamping, but the default has been raised to 80.
+ *
+ * We now allow the ratios to be set to anything, because there is less risk
+ * of OOM, and because databases and such will need more flexible tuning,
+ * now that they are being throttled too.
*
* We make sure that the background writeout level is below the adjusted
* clamping level.
@@ -136,9 +135,6 @@ static void
get_dirty_limits(struct writeback_state *wbs, long *pbackground, long *pdirty,
struct address_space *mapping)
{
- int background_ratio; /* Percentages */
- int dirty_ratio;
- int unmapped_ratio;
long background;
long dirty;
unsigned long available_memory = total_pages;
@@ -155,27 +151,16 @@ get_dirty_limits(struct writeback_state
available_memory -= totalhigh_pages;
#endif
-
- unmapped_ratio = 100 - (wbs->nr_mapped * 100) / total_pages;
-
- dirty_ratio = vm_dirty_ratio;
- if (dirty_ratio > unmapped_ratio / 2)
- dirty_ratio = unmapped_ratio / 2;
-
- if (dirty_ratio < 5)
- dirty_ratio = 5;
-
- background_ratio = dirty_background_ratio;
- if (background_ratio >= dirty_ratio)
- background_ratio = dirty_ratio / 2;
-
- background = (background_ratio * available_memory) / 100;
- dirty = (dirty_ratio * available_memory) / 100;
+ background = (dirty_background_ratio * available_memory) / 100;
+ dirty = (vm_dirty_ratio * available_memory) / 100;
tsk = current;
if (tsk->flags & PF_LESS_THROTTLE || rt_task(tsk)) {
background += background / 4;
- dirty += dirty / 4;
+ dirty += dirty / 8;
}
+ if (background > dirty)
+ background = dirty;
+
*pbackground = background;
*pdirty = dirty;
}
--
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>
next reply other threads:[~2006-06-21 17:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-21 17:01 Nate Diller [this message]
2006-06-21 18:08 ` Nick Piggin
2006-06-21 22:25 ` Nate Diller
2006-06-23 7:31 ` Hans Reiser
2006-06-21 18:13 ` Martin Bligh
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=5c49b0ed0606211001s452c080cu3f55103a130b78f1@mail.gmail.com \
--to=nate.diller@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@osdl.org \
--cc=christoph@lameter.com \
--cc=dhowells@redhat.com \
--cc=grev@namesys.com \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mbligh@google.com \
--cc=npiggin@suse.de \
--cc=reiser@namesys.com \
--cc=torvalds@osdl.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