From: Nick Piggin <piggin@cyberone.com.au>
To: Con Kolivas <kernel@kolivas.org>
Cc: "Martin J. Bligh" <mbligh@aracnet.com>,
linux kernel mailing list <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] Autoregulate vm swappiness cleanup
Date: Sun, 26 Oct 2003 22:22:23 +1100 [thread overview]
Message-ID: <3F9BAE6F.5070009@cyberone.com.au> (raw)
In-Reply-To: <200310251658.23070.kernel@kolivas.org>
Con Kolivas wrote:
>On Fri, 24 Oct 2003 01:03, Con Kolivas wrote:
>
>>On Friday 24 October 2003 00:42, Martin J. Bligh wrote:
>>
>>>It seems that you don't need si_swapinfo here, do you? i.freeram,
>>>i.bufferram, and i.totalram all come from meminfo, as far as I can
>>>see? Maybe I'm missing a bit ...
>>>
>>Well I did do it a while ago and it seems I got carried away adding and
>>subtracting info indeed. :-) Here's a simpler patch that does the same
>>thing.
>>
>
>The off-list enthusiasm has been rather strong so here is a patch done the
>right way (tm). There is no need for the check of totalram being zero (the
>original version of this patch modified the swappiness every tick which was
>wasteful and had a divide by zero on init). Adjusting vm_swappiness only when
>there is pressure to swap means totalram shouldn't be ever be zero. The
>sysctl is made read only since writing to it would be ignored now.
>
>Con
>
>
>
>------------------------------------------------------------------------
>
>--- linux-2.6.0-test8-base/kernel/sysctl.c 2003-10-19 20:24:49.000000000 +1000
>+++ linux-2.6.0-test8-am/kernel/sysctl.c 2003-10-25 16:37:44.384824976 +1000
>@@ -664,11 +664,8 @@ static ctl_table vm_table[] = {
> .procname = "swappiness",
> .data = &vm_swappiness,
> .maxlen = sizeof(vm_swappiness),
>- .mode = 0644,
>- .proc_handler = &proc_dointvec_minmax,
>- .strategy = &sysctl_intvec,
>- .extra1 = &zero,
>- .extra2 = &one_hundred,
>+ .mode = 0444 /* read-only*/,
>+ .proc_handler = &proc_dointvec,
> },
> #ifdef CONFIG_HUGETLB_PAGE
> {
>--- linux-2.6.0-test8-base/mm/vmscan.c 2003-10-19 20:24:36.000000000 +1000
>+++ linux-2.6.0-test8-am/mm/vmscan.c 2003-10-25 16:40:33.099176496 +1000
>@@ -47,7 +47,7 @@
> /*
> * From 0 .. 100. Higher means more swappy.
> */
>-int vm_swappiness = 60;
>+int vm_swappiness = 0;
> static long total_memory;
>
> #ifdef ARCH_HAS_PREFETCH
>@@ -600,6 +600,7 @@ refill_inactive_zone(struct zone *zone,
> LIST_HEAD(l_active); /* Pages to go onto the active_list */
> struct page *page;
> struct pagevec pvec;
>+ struct sysinfo i;
> int reclaim_mapped = 0;
> long mapped_ratio;
> long distress;
>@@ -642,6 +643,14 @@ refill_inactive_zone(struct zone *zone,
> mapped_ratio = (ps->nr_mapped * 100) / total_memory;
>
> /*
>+ * Autoregulate vm_swappiness to be equal to the percentage of
>+ * pages in physical ram that are application pages. -ck
>+ */
>+ si_meminfo(&i);
>+ vm_swappiness = 100 - (((i.freeram + get_page_cache_size() -
>+ swapper_space.nrpages) * 100) / i.totalram);
>+
>+ /*
> * Now decide how much we really want to unmap some pages. The mapped
> * ratio is downgraded - just because there's a lot of mapped memory
> * doesn't necessarily mean that page reclaim isn't succeeding.
>
Hi Con,
If this indeed makes VM behaviour better, why not just merge the calculation
with the swap_tendancy calculation and leave vm_swappiness there as a
tunable?
next prev parent reply other threads:[~2003-10-26 10:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-23 13:37 [PATCH] Autoregulate vm swappiness 2.6.0-test8 Con Kolivas
2003-10-23 14:42 ` Martin J. Bligh
2003-10-23 15:03 ` Con Kolivas
2003-10-25 6:58 ` [PATCH] Autoregulate vm swappiness cleanup Con Kolivas
2003-10-26 11:22 ` Nick Piggin [this message]
2003-10-26 10:36 ` Con Kolivas
2003-10-26 11:42 ` Nick Piggin
2003-10-28 11:04 ` Pavel Machek
2003-10-28 12:40 ` Con Kolivas
2003-10-28 13:34 Boszormenyi Zoltan
2003-10-28 14:39 ` Richard B. Johnson
2003-10-28 15:39 ` Valdis.Kletnieks
2003-10-28 15:54 ` Richard B. Johnson
2003-10-28 16:37 ` Valdis.Kletnieks
2003-10-28 16:51 ` Måns Rullgård
2003-10-28 17:33 ` Valdis.Kletnieks
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=3F9BAE6F.5070009@cyberone.com.au \
--to=piggin@cyberone.com.au \
--cc=akpm@osdl.org \
--cc=kernel@kolivas.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@aracnet.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
Powered by JetHome