aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2006-03-22 00:09:04 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-22 07:54:05 -0800
commit248a0301e703cbf781aa02a91bcfc6da75870dd7 (patch)
tree74168da24983ec948fb25f92c2b3a1b9d76a5f13 /mm
parentd5d4b0aa4e1430d73050babba999365593bdb9d2 (diff)
downloadkernel_samsung_smdk4412-248a0301e703cbf781aa02a91bcfc6da75870dd7.zip
kernel_samsung_smdk4412-248a0301e703cbf781aa02a91bcfc6da75870dd7.tar.gz
kernel_samsung_smdk4412-248a0301e703cbf781aa02a91bcfc6da75870dd7.tar.bz2
[PATCH] mm: make shrink_all_memory try harder
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> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/vmscan.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f713e9f..548e023 100644
--- a/mm/vmscan.c
+++ b/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>
@@ -1784,11 +1785,13 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
pg_data_t *pgdat;
unsigned long nr_to_free = nr_pages;
unsigned long ret = 0;
+ unsigned retry = 2;
struct reclaim_state reclaim_state = {
.reclaimed_slab = 0,
};
current->reclaim_state = &reclaim_state;
+repeat:
for_each_pgdat(pgdat) {
unsigned long freed;
@@ -1798,6 +1801,10 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
if ((long)nr_to_free <= 0)
break;
}
+ if (retry-- && ret < nr_pages) {
+ blk_congestion_wait(WRITE, HZ/5);
+ goto repeat;
+ }
current->reclaim_state = NULL;
return ret;
}