public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Autotune swappiness01
@ 2004-07-26 21:29 DaMouse
  0 siblings, 0 replies; 32+ messages in thread
From: DaMouse @ 2004-07-26 21:29 UTC (permalink / raw)
  To: linux-kernel

Perhaps the answer is a CONFIG_USERCONFIG or similar like in the car scenario,
those who like to take tools with them to fiddle and those who just like to drive.

-DaMouse

Previous Messages:

On Monday 26 of July 2004 20:45, Adam Kropelin wrote:
> On Mon, Jul 26, 2004 at 03:53:09PM +0200, R. J. Wysocki wrote:
> > On Monday 26 of July 2004 13:47, Nick Piggin wrote:
> > > Con Kolivas wrote:
> > > > Nick Piggin wrote:
> > > >> Con Kolivas wrote:
> > > >>> In my ideal, nonsensical, impossible to obtain world we have an
> > > >>> autoregulating operating system that doesn't need any knobs.
> > > >>
> > > >> Some thinks are fundamental tradeoffs that can't be autotuned.
> > > >>
> > > >> Latency vs throughput comes up in a lot of places, eg. timeslices.
> > > >>
> > > >> Maximum throughput via effective use of swap, versus swapping as
> > > >> a last resort may be another.
> > > >
> > > > As I said... it was ideal, nonsensical, and impossible. Doesn't sound
> > > > like you're arguing with me.
> > >
> > > No, you're right. My ideal operating system knows what the user
> > > wants too ;)
> >
> > Well, what I hate about various computer programs is that they seem to
> > assume to know what I (the USER) want and they don't let me do anything
> > else that they "know" what I should/would do. ;-)
> >
> > > Most of the time though, you are right. The quality/desirability of an
> > > implementation will be inversely proportional to the number of knobs
> > > sticking out of it (with bonus points for those that are meaningful to
> > > 2 people on the planet).
> >
> > Can you please tell me why you think that the least tunable
> > implementation should be the best/most desirable one?  I always prefer
> > the most tunable implementations which is quite opposite to what you have
> > said, but this is my personal opinion, of course.
>
> The implementation with the least *need* for tuning is the most
> desirable. I, for one, don't care if there are a dozen knobs as long as
> 99% of users don't have to touch them. But if common usage scenarios
> require turning knobs to get reasonable performance, the algorithm is
> lacking.

I agree in 100%.

> Thanks to fuel injection and engine management I can drive from LA to
> Denver and not need to tweak my carburator half way up the Rockies.
> I've given up some chances for tuning, but overall I'm better off. If
> you want to stick a trimpot or ten out the side of the engine management
> computer so true gearheads can tweak another couple HP or MPG out of the
> engine, great. But don't expect me to fiddle with it every time driving
> conditions change; it's not an excuse to make the management algorithms
> inadequate for common driving patterns.

I didn't mean that.  Actually, I was trying to say that an additional "knob" 
(or "knobs") might be useful in determining the "common settings" acceptable 
for the 99% of users.  Then, it could be "hidden" (which I wouldn't do, but 
well ...).
Yours,
rjw


^ permalink raw reply	[flat|nested] 32+ messages in thread
* Re: Autotune swappiness01
@ 2004-07-26 14:52 Martin Knoblauch
  0 siblings, 0 replies; 32+ messages in thread
From: Martin Knoblauch @ 2004-07-26 14:52 UTC (permalink / raw)
  To: linux-kernel

>On Monday 26 of July 2004 13:47, Nick Piggin wrote:
>> Con Kolivas wrote:
>
>> No, you're right. My ideal operating system knows what the user
>> wants too ;)
>
>Well, what I hate about various computer programs is that they seem to
assume
>to know what I (the USER) want and they don't let me do anything else
that
>they "know" what I should/would do. ;-)

 In Cons' ideal world the OS/program knows what you want, does the
right thing, keeps you from mesiing stuff up -and you love it :-)

 But we all agreed do far - things are not ideal, so some knowbs are
needed. Latency is one area, VM another.


Martin


=====
------------------------------------------------------
Martin Knoblauch
email: k n o b i AT knobisoft DOT de
www:   http://www.knobisoft.de

^ permalink raw reply	[flat|nested] 32+ messages in thread
* [PATCH][2.6.8-rc1-mm1] Autotune swappiness01
@ 2004-07-26  0:25 Con Kolivas
  2004-07-26  0:36 ` Andrew Morton
  0 siblings, 1 reply; 32+ messages in thread
From: Con Kolivas @ 2004-07-26  0:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

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

Attached is a patch designed to improve the behaviour of the swappiness knob 
in 2.6.8-rc1-mm1. 

The current mechanism decides to reclaim mapped pages based on the 
combination of mapped_ratio/2 and the manual setting of swappiness currently 
tuned to 60. Biasing this mechanism to be proportional to the square root of 
mapped_ratio gives good overall performance improvement for desktop 
workloads without any noticable detriment to other loads. It has the effect 
of being fairly aggressive at avoiding loss of applications to swap under 
conditions of heavy or sustained file stress while allowing applications to 
swap out under what would be considered "application" memory stresses on a 
desktop. It has no measurable effect on any known benchmarks.

The swappiness knob is kept intact and ironically is set to the same value 
of 60, and overall behaves the same as previous patches posted for 
autoregulating swappiness. The idea of this patch is to ultimately deprecate 
the need for a swappiness knob if this achieves good performance in most 
workloads.

Signed-off-by: Con Kolivas <kernel@kolivas.org>


[-- Attachment #2: Autotune Swappiness --]
[-- Type: text/plain, Size: 1229 bytes --]

Index: linux-2.6.8-rc1/mm/vmscan.c
===================================================================
--- linux-2.6.8-rc1.orig/mm/vmscan.c	2004-07-15 09:59:34.820962044 +1000
+++ linux-2.6.8-rc1/mm/vmscan.c	2004-07-15 10:03:06.243433612 +1000
@@ -119,6 +119,7 @@
  * From 0 .. 100.  Higher means more swappy.
  */
 int vm_swappiness = 60;
+static int mapped_bias;
 static long total_memory;
 
 static LIST_HEAD(shrinker_list);
@@ -646,6 +647,7 @@
 	struct page *page;
 	struct pagevec pvec;
 	int reclaim_mapped = 0;
+	int swappiness_bias;
 	long mapped_ratio;
 	long distress;
 	long swap_tendency;
@@ -690,6 +692,7 @@
 	 * is mapped.
 	 */
 	mapped_ratio = (sc->nr_mapped * 100) / total_memory;
+	mapped_bias = mapped_ratio * mapped_ratio;
 
 	/*
 	 * Now decide how much we really want to unmap some pages.  The mapped
@@ -700,7 +703,9 @@
 	 *
 	 * A 100% value of vm_swappiness overrides this algorithm altogether.
 	 */
-	swap_tendency = mapped_ratio / 2 + distress + vm_swappiness;
+	swappiness_bias = vm_swappiness * vm_swappiness / 100;
+	swappiness_bias = 101 - swappiness_bias;
+	swap_tendency = distress + mapped_bias / swappiness_bias;
 
 	/*
 	 * Now use this metric to decide whether to start moving mapped memory

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2004-07-27 15:41 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-26 21:29 Autotune swappiness01 DaMouse
  -- strict thread matches above, loose matches on Subject: below --
2004-07-26 14:52 Martin Knoblauch
2004-07-26  0:25 [PATCH][2.6.8-rc1-mm1] " Con Kolivas
2004-07-26  0:36 ` Andrew Morton
2004-07-26  0:43   ` Con Kolivas
2004-07-26  0:48     ` Andrew Morton
2004-07-26  1:01       ` Con Kolivas
2004-07-26  1:09         ` Con Kolivas
2004-07-26  8:52           ` R. J. Wysocki
2004-07-26  9:31             ` Con Kolivas
2004-07-26 10:34               ` R. J. Wysocki
2004-07-26 10:29                 ` Con Kolivas
2004-07-26 10:54                   ` R. J. Wysocki
2004-07-26 11:03                     ` Con Kolivas
2004-07-26 11:13                       ` Nick Piggin
2004-07-26 11:17                         ` Con Kolivas
2004-07-26 11:47                           ` Nick Piggin
2004-07-26 13:53                             ` R. J. Wysocki
2004-07-26 18:45                               ` Adam Kropelin
2004-07-26 18:53                                 ` R. J. Wysocki
2004-07-26 17:55                     ` Gerrit Huizenga
2004-07-26 20:29     ` Joel Becker
2004-07-26 20:42       ` Andrew Morton
2004-07-26 22:58         ` Con Kolivas
2004-07-27  0:52           ` Clemens Schwaighofer
2004-07-27  1:09             ` Andrew Morton
2004-07-27  1:17               ` Clemens Schwaighofer
2004-07-27  2:03                 ` Tim Connors
2004-07-27  2:43                   ` Con Kolivas
2004-07-27  3:02                     ` Tim Connors
2004-07-27  3:43                       ` Clemens Schwaighofer
2004-07-27  3:47                       ` Joel Becker
2004-07-27 15:32                         ` William Lee Irwin III
2004-07-27  3:41                   ` Clemens Schwaighofer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox