From: Andrew Morton <akpm@osdl.org>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: kas@fi.muni.cz, nickpiggin@yahoo.com.au,
linux-kernel@vger.kernel.org, bharata@in.ibm.com
Subject: Re: 2.6.14 kswapd eating too much CPU
Date: Sun, 27 Nov 2005 15:21:08 -0800 [thread overview]
Message-ID: <20051127152108.11f58f9c.akpm@osdl.org> (raw)
In-Reply-To: <20051127160207.GE21383@logos.cnet>
Marcelo Tosatti <marcelo.tosatti@cyclades.com> wrote:
>
> It does seem to scan SLABs intensively:
>
It might be worth trying the below. Mainly for the debugging check.
From: Andrea Arcangeli <andrea@suse.de>
Greg Edwards found some deadlock in the icache shrinker.
I believe the major bug is that the VM is currently potentially setting nr
= LONG_MAX before shrinking the icache (and the icache shrinker never
returns -1, which means the api doesn't currently require shrinkers to
return -1 when they're finished).
The below is the most obviously safe way I could address this problem
(still untested).
This is not necessairly the way we want to fix it in mainline, but it at
least shows what I believe to be the major cuplrit in the code (i.e. nr
growing insane ;).
Signed-off-by: Andrea Arcangeli <andrea@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---
mm/vmscan.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff -puN mm/vmscan.c~shrinker-nr-=-long_max-means-deadlock-for-icache mm/vmscan.c
--- devel/mm/vmscan.c~shrinker-nr-=-long_max-means-deadlock-for-icache 2005-11-19 02:53:18.000000000 -0800
+++ devel-akpm/mm/vmscan.c 2005-11-19 03:00:25.000000000 -0800
@@ -201,13 +201,25 @@ static int shrink_slab(unsigned long sca
list_for_each_entry(shrinker, &shrinker_list, list) {
unsigned long long delta;
unsigned long total_scan;
+ unsigned long max_pass = (*shrinker->shrinker)(0, gfp_mask);
delta = (4 * scanned) / shrinker->seeks;
- delta *= (*shrinker->shrinker)(0, gfp_mask);
+ delta *= max_pass;
do_div(delta, lru_pages + 1);
shrinker->nr += delta;
- if (shrinker->nr < 0)
- shrinker->nr = LONG_MAX; /* It wrapped! */
+ if (shrinker->nr < 0) {
+ printk(KERN_ERR "%s: nr=%ld\n",
+ __FUNCTION__, shrinker->nr);
+ shrinker->nr = max_pass;
+ }
+
+ /*
+ * Avoid risking looping forever due to too large nr value:
+ * never try to free more than twice the estimate number of
+ * freeable entries.
+ */
+ if (shrinker->nr > max_pass * 2)
+ shrinker->nr = max_pass * 2;
total_scan = shrinker->nr;
shrinker->nr = 0;
_
next prev parent reply other threads:[~2005-11-27 23:21 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-22 12:59 Jan Kasprzak
2005-11-23 0:35 ` Andrew Morton
2005-11-23 1:01 ` Jan Kasprzak
2005-11-23 2:19 ` Nick Piggin
2005-11-23 5:13 ` Jan Kasprzak
2005-11-23 13:14 ` Jan Kasprzak
2005-11-23 19:02 ` Andrew Morton
2005-11-23 20:24 ` Jan Kasprzak
2005-11-23 20:32 ` Jesper Juhl
2005-11-23 20:34 ` Jan Kasprzak
2005-11-23 20:35 ` Andrew Morton
2005-11-24 8:31 ` Jan Kasprzak
2005-11-27 8:42 ` Marcelo Tosatti
2005-11-27 20:39 ` Jan Kasprzak
2005-11-27 15:45 ` Marcelo Tosatti
2005-11-27 16:02 ` Marcelo Tosatti
2005-11-27 23:21 ` Andrew Morton [this message]
2005-11-28 13:16 ` Jan Kasprzak
2005-11-28 8:04 ` Marcelo Tosatti
2005-12-06 0:10 ` Jan Kasprzak
2005-12-06 18:14 ` Marcelo Tosatti
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=20051127152108.11f58f9c.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=bharata@in.ibm.com \
--cc=kas@fi.muni.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
--cc=nickpiggin@yahoo.com.au \
/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
all inboxes | Powered by JetHome®