linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ray Bryant <raybry@sgi.com>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: Con Kolivas <kernel@kolivas.org>, Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	riel@redhat.com, piggin@cyberone.com.au, mbligh@aracnet.com
Subject: Re: swapping and the value of /proc/sys/vm/swappiness
Date: Wed, 08 Sep 2004 09:20:08 -0500	[thread overview]
Message-ID: <413F1518.7050608@sgi.com> (raw)
In-Reply-To: <20040907212051.GC3492@logos.cnet>

[-- Attachment #1: Type: text/plain, Size: 1892 bytes --]



Marcelo Tosatti wrote:

> 
> Andrew, dirty_ratio and dirty_background_ratio (as low as 5% each) did not significantly 
> affect the amount of swapped out data, only a small effect on _how soon_ anonymous 
> memory was swapped out.
> 

I looked at the get_dirty_limits() code and for the test cases I was running,
we have mapped > 90% of memory.  So what will happen is that dirty_ratio will 
be thresholded at 5%, and background_ratio will be 1%.  Changing values in 
/proc won't modify this at all (well, you could force background_ratio to 0%.)

It seems to me that the 5% number in there is more or less arbitrary.  If we 
are on a big memory Altix (4 TB), 5% of memory would be 200 GB. That is a lot 
of page cache.

It seems get_dirty_limits() would be a lot simpler (and automatically scale as 
memory is mapped) if the limits were interpreted as being in terms of the 
amount of unmapped memory.  A patch that implements this idea is attached.
(Andrew -- if it comes to that I can submit this patch inline -- this is just 
for talking at the moment).

I'll run a few of the tests with this modified kernel and see if they are any 
different.

> And finally, Ray, the difference you see between 2.6.6 and 2.6.7 can be explained, 
> as noted by others in this thread, to vmscan.c changes (page replacement/scanning policy
> changes were made).

Yep.  I can probably live with those minor differences though.  I would be 
happier if the system didn't swap anything at all for low values of 
swappiness, though.

> 
> Will continue with more tests tomorrow.
> 

-- 
Best Regards,
Ray
-----------------------------------------------
                   Ray Bryant
512-453-9679 (work)         512-507-7807 (cell)
raybry@sgi.com             raybry@austin.rr.com
The box said: "Requires Windows 98 or better",
            so I installed Linux.
-----------------------------------------------

[-- Attachment #2: dirty-limits-in-terms-of-unmapped.patch --]
[-- Type: text/plain, Size: 1404 bytes --]

Index: linux-2.6.9-rc1-mm3-kdb/mm/page-writeback.c
===================================================================
--- linux-2.6.9-rc1-mm3-kdb.orig/mm/page-writeback.c	2004-09-03 10:18:57.000000000 -0700
+++ linux-2.6.9-rc1-mm3-kdb/mm/page-writeback.c	2004-09-07 14:46:24.000000000 -0700
@@ -135,32 +135,19 @@
 static void
 get_dirty_limits(struct writeback_state *wbs, long *pbackground, long *pdirty)
 {
-	int background_ratio;		/* Percentages */
-	int dirty_ratio;
-	int unmapped_ratio;
+	int unmapped;
 	long background;
 	long dirty;
 	struct task_struct *tsk;
 
 	get_writeback_state(wbs);
 
-	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;
+	unmapped = total_pages - wbs->nr_mapped;
 
-	if (dirty_ratio < 5)
-		dirty_ratio = 5;
+	background = (dirty_background_ratio * unmapped) / 100;
+	dirty      = (vm_dirty_ratio * unmapped) / 100;
 
-	/*
-	 * Keep the ratio between dirty_ratio and background_ratio roughly
-	 * what the sysctls are after dirty_ratio has been scaled (above).
-	 */
-	background_ratio = dirty_background_ratio * dirty_ratio/vm_dirty_ratio;
-
-	background = (background_ratio * total_pages) / 100;
-	dirty = (dirty_ratio * total_pages) / 100;
 	tsk = current;
 	if (tsk->flags & PF_LESS_THROTTLE || rt_task(tsk)) {
 		background += background / 4;

  parent reply	other threads:[~2004-09-08 14:20 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-06 19:11 Ray Bryant
2004-09-06 20:10 ` Andrew Morton
2004-09-06 21:22   ` Ray Bryant
2004-09-06 21:36     ` Andrew Morton
2004-09-06 22:37     ` William Lee Irwin III
2004-09-06 23:51       ` Nick Piggin
2004-09-07  0:31         ` Ray Bryant
2004-09-06 22:48 ` William Lee Irwin III
2004-09-06 23:09 ` Con Kolivas
2004-09-06 23:27   ` Andrew Morton
2004-09-06 23:34     ` Con Kolivas
2004-09-07  0:03       ` Marcelo Tosatti
2004-09-07  1:34         ` Con Kolivas
2004-09-07 10:38         ` Nick Piggin
2004-09-07 10:56           ` Con Kolivas
2004-09-08 16:45             ` Marcelo Tosatti
2004-09-09  1:12               ` Con Kolivas
2004-09-07 17:03           ` Ray Bryant
2004-09-07 21:20         ` Marcelo Tosatti
2004-09-08  2:18           ` Marcelo Tosatti
2004-09-08 14:20           ` Ray Bryant [this message]
2004-09-08 16:54             ` Marcelo Tosatti
2004-09-08 19:35               ` Ray Bryant
2004-09-08 19:30                 ` Marcelo Tosatti
2004-09-09  3:06                   ` Ray Bryant
2004-09-09  2:14                     ` Marcelo Tosatti
2004-09-09 14:21                       ` Ray Bryant
2004-09-09  3:09                     ` William Lee Irwin III
2004-09-09 14:16                       ` Ray Bryant
2004-09-09 17:23                         ` William Lee Irwin III
2004-09-28  1:54                       ` Ray Bryant
2004-09-28  3:36                         ` Nick Piggin
2004-09-29  0:36                           ` Nick Piggin
2004-09-29  4:23                             ` Ray Bryant
2004-09-30 17:15                             ` Ray Bryant
2004-09-08 17:31             ` Martin J. Bligh
2004-09-08 18:04               ` Rik van Riel
2004-09-08 19:50                 ` Diego Calleja
2004-09-08 21:10                   ` Martin J. Bligh
2004-09-08 21:55                     ` Diego Calleja
2004-09-08 22:20                       ` Martin J. Bligh
2004-09-08 23:22                         ` Rik van Riel
2004-09-08 22:28                     ` Alan Cox
2004-09-08 23:42                       ` Martin J. Bligh
2004-09-08 19:54               ` Ray Bryant
2004-09-08 15:19           ` Ray Bryant

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=413F1518.7050608@sgi.com \
    --to=raybry@sgi.com \
    --cc=akpm@osdl.org \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=mbligh@aracnet.com \
    --cc=piggin@cyberone.com.au \
    --cc=riel@redhat.com \
    /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