Messages in this thread Patch in this message | | | From | "Rafael J. Wysocki" <> | Subject | [RFC][PATCH -mm 2/2] mm: make shrink_all_memory try harder | Date | Mon, 27 Feb 2006 19:30:02 +0100 |
| |
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; } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |