linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: Nick Piggin <npiggin@suse.de>,
	Linux Memory Management <linux-mm@kvack.org>
Subject: [patch 2/9] oom: reclaim_mapped on oom
Date: Fri, 28 Jul 2006 09:21:01 +0200 (CEST)	[thread overview]
Message-ID: <20060515210547.30275.23248.sendpatchset@linux.site> (raw)
In-Reply-To: <20060515210529.30275.74992.sendpatchset@linux.site>

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@suse.de>

Index: linux-2.6/mm/vmscan.c
===================================================================
--- linux-2.6.orig/mm/vmscan.c
+++ linux-2.6/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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2006-07-28  7:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-28  7:20 [patch 0/9] oom: various fixes and improvements for 2.6.18-rc2 Nick Piggin
2006-07-28  7:20 ` [patch 1/9] oom: use unreclaimable info Nick Piggin
2006-07-28  7:21 ` Nick Piggin [this message]
2006-07-28  7:21 ` [patch 3/9] cpuset: oom panic fix Nick Piggin
2006-07-28  7:29   ` Nick Piggin
2006-07-28  9:06   ` Paul Jackson
2006-07-28  7:21 ` [patch 4/9] oom: cpuset hint Nick Piggin
2006-07-28  9:07   ` Paul Jackson
2006-07-28  7:21 ` [patch 5/9] oom: handle current exiting Nick Piggin
2006-07-28  7:21 ` [patch 6/9] oom: handle oom_disable exiting Nick Piggin
2006-07-28  7:21 ` [patch 7/9] oom: swapoff tasks tweak Nick Piggin
2006-07-28  7:21 ` [patch 8/9] oom: kthread infinite loop fix Nick Piggin
2006-07-28  7:22 ` [patch 9/9] oom: more printk Nick Piggin
2006-07-28  7:44 ` [patch 0/9] oom: various fixes and improvements for 2.6.18-rc2 Andrew Morton
2006-07-28  9:28   ` Nick Piggin

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=20060515210547.30275.23248.sendpatchset@linux.site \
    --to=npiggin@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-mm@kvack.org \
    /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