The patch titled oom: reclaim_mapped on oom has been added to the -mm tree. Its filename is oom-reclaim_mapped-on-oom.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: oom: reclaim_mapped on oom From: Nick Piggin <npiggin@xxxxxxx> Potentially it takes several scans of the lru lists before we can even start reclaiming pages. mapped pages, with young ptes can take 2 passes on the active list + one on the inactive list. But reclaim_mapped may not always kick in instantly, so it could take even more than that. Raise the threshold for marking a zone as all_unreclaimable from a factor of 4 time the pages in the zone to 6. Introduce a mechanism to force reclaim_mapped if we've reached a factor 3 and still haven't made progress. Previously, a customer doing stress testing was able to easily OOM the box after using only a small fraction of its swap (~100MB). After the patches, it would only OOM after having used up all swap (~800MB). Signed-off-by: Nick Piggin <npiggin@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- mm/vmscan.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff -puN mm/vmscan.c~oom-reclaim_mapped-on-oom mm/vmscan.c --- a/mm/vmscan.c~oom-reclaim_mapped-on-oom +++ a/mm/vmscan.c @@ -697,6 +697,11 @@ done: 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 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 * memory onto the inactive list. */ if (swap_tendency >= 100) +force_reclaim_mapped: reclaim_mapped = 1; } @@ -1161,7 +1170,7 @@ scan: 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 _ Patches currently in -mm which might be from npiggin@xxxxxxx are mm-vm_bug_on.patch radix-tree-rcu-lockless-readside.patch redo-radix-tree-fixes.patch adix-tree-rcu-lockless-readside-update.patch adix-tree-rcu-lockless-readside-fix-2.patch update-some-mm-comments.patch mm-remove_mapping-safeness.patch mm-non-syncing-lock_page.patch oom-use-unreclaimable-info.patch oom-reclaim_mapped-on-oom.patch cpuset-oom-panic-fix.patch oom-cpuset-hint.patch oom-handle-current-exiting.patch oom-handle-oom_disable-exiting.patch oom-swapoff-tasks-tweak.patch oom-kthread-infinite-loop-fix.patch oom-more-printk.patch sched-force-sbin-init-off-isolated-cpus.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html