From 7fc74d2a35bcba5881c00ebb53a9743932442a42 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Mon, 25 Sep 2006 23:31:28 -0700 Subject: [PATCH] --- yaml --- r: 35601 b: refs/heads/master c: 4ff1ffb4870b007b86f21e5f27eeb11498c4c077 h: refs/heads/master i: 35599: 323bfcc08a07a7d0a41317e5628bb10b92038db3 v: v3 --- [refs] | 2 +- trunk/mm/vmscan.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index c2284f493c83..24978a5258eb 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 408d85441cd5a9bd6bc851d677a10c605ed8db5f +refs/heads/master: 4ff1ffb4870b007b86f21e5f27eeb11498c4c077 diff --git a/trunk/mm/vmscan.c b/trunk/mm/vmscan.c index ba18d0c36b83..8f35d7d585cb 100644 --- a/trunk/mm/vmscan.c +++ b/trunk/mm/vmscan.c @@ -697,6 +697,11 @@ static unsigned long shrink_inactive_list(unsigned long max_scan, return nr_reclaimed; } +static inline int zone_is_near_oom(struct zone *zone) +{ + return zone->pages_scanned >= (zone->nr_active + zone->nr_inactive)*3; +} + /* * This moves pages from the active list to the inactive list. * @@ -732,6 +737,9 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone, long distress; long swap_tendency; + if (zone_is_near_oom(zone)) + goto force_reclaim_mapped; + /* * `distress' is a measure of how much trouble we're having * reclaiming pages. 0 -> no problems. 100 -> great trouble. @@ -767,6 +775,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone, * memory onto the inactive list. */ if (swap_tendency >= 100) +force_reclaim_mapped: reclaim_mapped = 1; } @@ -1161,7 +1170,7 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order) if (zone->all_unreclaimable) continue; if (nr_slab == 0 && zone->pages_scanned >= - (zone->nr_active + zone->nr_inactive) * 4) + (zone->nr_active + zone->nr_inactive) * 6) zone->all_unreclaimable = 1; /* * If we've done a decent amount of scanning and