From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Pavel Machek <pavel@suse.cz>
Cc: Andrew Morton <akpm@osdl.org>, LKML <linux-kernel@vger.kernel.org>
Subject: [RFC][PATCH -mm 2/2] mm: make shrink_all_memory try harder
Date: Mon, 27 Feb 2006 19:30:02 +0100 [thread overview]
Message-ID: <200602271930.03171.rjw@sisk.pl> (raw)
In-Reply-To: <200602271926.20294.rjw@sisk.pl>
Make shrink_all_memory() repeat the attempts to free more memory if there
seems to be no pages to free.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
mm/vmscan.c | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
Index: linux-2.6.16-rc4-mm2/mm/vmscan.c
===================================================================
--- linux-2.6.16-rc4-mm2.orig/mm/vmscan.c
+++ linux-2.6.16-rc4-mm2/mm/vmscan.c
@@ -33,6 +33,7 @@
#include <linux/cpuset.h>
#include <linux/notifier.h>
#include <linux/rwsem.h>
+#include <linux/delay.h>
#include <asm/tlbflush.h>
#include <asm/div64.h>
@@ -1793,17 +1794,24 @@ unsigned long shrink_all_memory(unsigned
struct reclaim_state reclaim_state = {
.reclaimed_slab = 0,
};
+ int retry = 2;
current->reclaim_state = &reclaim_state;
- for_each_pgdat(pgdat) {
- unsigned long freed;
+ do {
+ for_each_pgdat(pgdat) {
+ unsigned long freed;
- freed = balance_pgdat(pgdat, nr_to_free, 0);
- ret += freed;
- nr_to_free -= freed;
- if (nr_to_free <= 0)
+ freed = balance_pgdat(pgdat, nr_to_free, 0);
+ ret += freed;
+ nr_to_free -= freed;
+ if (nr_to_free <= 0)
+ break;
+ }
+ if (ret > 0)
break;
- }
+ if (retry)
+ msleep_interruptible(100);
+ } while (retry--);
current->reclaim_state = NULL;
return ret;
}
next prev parent reply other threads:[~2006-02-27 18:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-27 18:26 [RFC][PATCH -mm 0/2] mm: shrink_all_memory improvements Rafael J. Wysocki
2006-02-27 18:28 ` [RFC][PATCH -mm 1/2] mm: make shrink_all_memory overflow-resistant Rafael J. Wysocki
2006-02-27 18:53 ` Jesper Juhl
2006-02-27 19:02 ` Pavel Machek
2006-02-27 19:06 ` Jesper Juhl
2006-02-27 23:15 ` Rafael J. Wysocki
2006-02-28 3:16 ` Andrew Morton
2006-02-28 17:28 ` Rafael J. Wysocki
2006-02-27 18:30 ` Rafael J. Wysocki [this message]
2006-02-28 3:25 ` [RFC][PATCH -mm 2/2] mm: make shrink_all_memory try harder Andrew Morton
2006-02-28 17:25 ` Rafael J. Wysocki
2006-02-28 18:46 ` Andrew Morton
2006-02-28 23:04 ` Rafael J. Wysocki
2006-02-27 18:33 ` [RFC][PATCH -mm 0/2] mm: shrink_all_memory improvements Pavel Machek
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=200602271930.03171.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@suse.cz \
/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