From: Andrea Arcangeli <andrea@cpushare.com>
To: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Rientjes <rientjes@google.com>
Subject: [PATCH 01 of 11] limit shrink zone scanning
Date: Thu, 03 Jan 2008 03:09:07 +0100 [thread overview]
Message-ID: <0d6cfa8fbffe9d3593ff.1199326147@v2.random> (raw)
In-Reply-To: <patchbomb.1199326146@v2.random>
# HG changeset patch
# User Andrea Arcangeli <andrea@suse.de>
# Date 1199324664 -3600
# Node ID 0d6cfa8fbffe9d3593fff5d50e47d0217a8ae1b7
# Parent e28e1be3fae5183e3e36e32e3feb9a59ec59c825
limit shrink zone scanning
Assume two tasks adds to nr_scan_*active at the same time (first line of the
old buggy code), they'll effectively double their scan rate, for no good
reason. What can happen is that instead of scanning nr_entries each, they'll
scan nr_entries*2 each. The more CPUs the bigger the race and the higher the
multiplication effect and the harder it will be to detect oom. This puts a cap
on the amount of work that it makes sense to do in case the race triggers.
Signed-off-by: Andrea Arcangeli <andrea@suse.de>
diff --git a/mm/vmscan.c b/mm/vmscan.c
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1114,7 +1114,7 @@ static unsigned long shrink_zone(int pri
*/
zone->nr_scan_active +=
(zone_page_state(zone, NR_ACTIVE) >> priority) + 1;
- nr_active = zone->nr_scan_active;
+ nr_active = min(zone->nr_scan_active, zone_page_state(zone, NR_ACTIVE));
if (nr_active >= sc->swap_cluster_max)
zone->nr_scan_active = 0;
else
@@ -1122,7 +1122,7 @@ static unsigned long shrink_zone(int pri
zone->nr_scan_inactive +=
(zone_page_state(zone, NR_INACTIVE) >> priority) + 1;
- nr_inactive = zone->nr_scan_inactive;
+ nr_inactive = min(zone->nr_scan_inactive, zone_page_state(zone, NR_INACTIVE));
if (nr_inactive >= sc->swap_cluster_max)
zone->nr_scan_inactive = 0;
else
--
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>
next prev parent reply other threads:[~2008-01-03 2:09 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-03 2:09 [PATCH 00 of 11] oom deadlock fixes Andrea Arcangeli
2008-01-03 2:09 ` Andrea Arcangeli [this message]
2008-01-07 19:11 ` [PATCH 01 of 11] limit shrink zone scanning Christoph Lameter
2008-01-03 2:09 ` [PATCH 02 of 11] avoid oom deadlock in nfs_create_request Andrea Arcangeli
2008-01-07 19:13 ` Christoph Lameter
2008-01-03 2:09 ` [PATCH 03 of 11] prevent oom deadlocks during read/write operations Andrea Arcangeli
2008-01-07 19:15 ` Christoph Lameter
2008-01-07 19:26 ` Andrea Arcangeli
2008-01-03 2:09 ` [PATCH 04 of 11] avoid selecting already killed tasks Andrea Arcangeli
2008-01-03 9:40 ` David Rientjes
2008-01-03 13:41 ` Andrea Arcangeli
2008-01-03 18:47 ` David Rientjes
2008-01-03 19:54 ` Andrea Arcangeli
2008-01-03 20:49 ` David Rientjes
2008-01-07 19:17 ` Christoph Lameter
2008-01-03 2:09 ` [PATCH 05 of 11] reduce the probability of an OOM livelock Andrea Arcangeli
2008-01-07 19:32 ` Christoph Lameter
2008-01-03 2:09 ` [PATCH 06 of 11] balance_pgdat doesn't return the number of pages freed Andrea Arcangeli
2008-01-07 19:33 ` Christoph Lameter
2008-01-03 2:09 ` [PATCH 07 of 11] don't depend on PF_EXITING tasks to go away Andrea Arcangeli
2008-01-03 9:52 ` David Rientjes
2008-01-03 13:29 ` Andrea Arcangeli
2008-01-03 2:09 ` [PATCH 08 of 11] stop useless vm trashing while we wait the TIF_MEMDIE task to exit Andrea Arcangeli
2008-01-03 2:09 ` [PATCH 09 of 11] oom select should only take rss into account Andrea Arcangeli
2008-01-07 19:35 ` Christoph Lameter
2008-01-03 2:09 ` [PATCH 10 of 11] limit reclaim if enough pages have been freed Andrea Arcangeli
2008-01-07 19:37 ` Christoph Lameter
2008-01-08 7:28 ` Andrea Arcangeli
2008-01-03 2:09 ` [PATCH 11 of 11] not-wait-memdie Andrea Arcangeli
2008-01-03 9:55 ` David Rientjes
2008-01-03 13:06 ` Andrea Arcangeli
2008-01-03 18:54 ` David Rientjes
2008-01-07 19:43 ` Christoph Lameter
2008-01-08 1:57 ` David Rientjes
2008-01-08 3:25 ` Nick Piggin
2008-01-08 3:37 ` David Rientjes
2008-01-08 7:42 ` Nick Piggin
2008-01-08 7:45 ` Andrea Arcangeli
2008-01-08 7:37 ` Andrea Arcangeli
2008-01-08 7:31 ` Andrea Arcangeli
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=0d6cfa8fbffe9d3593ff.1199326147@v2.random \
--to=andrea@cpushare.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
/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