From: Rik van Riel <riel@redhat.com>
To: Richard Davies <richard@arachsys.com>
Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org, linux-mm@kvack.org,
Mel Gorman <mgorman@suse.de>, Shaohua Li <shli@kernel.org>,
Avi Kivity <avi@redhat.com>
Subject: [Qemu-devel] [PATCH -v2 2/2] make the compaction "skip ahead" logic robust
Date: Thu, 13 Sep 2012 15:54:50 -0400 [thread overview]
Message-ID: <20120913155450.7634148f@cuia.bos.redhat.com> (raw)
In-Reply-To: <20120913154824.44cc0e28@cuia.bos.redhat.com>
Argh. And of course I send out the version from _before_ the compile test,
instead of the one after! I am not used to caffeine any more and have had
way too much tea...
---8<---
Make the "skip ahead" logic in compaction resistant to compaction
wrapping around to the end of the zone. This can lead to less
efficient compaction when one thread has wrapped around to the
end of the zone, and another simultaneous compactor has not done
so yet. However, it should ensure that we do not suffer quadratic
behaviour any more.
Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Richard Davies <richard@daviesmail.org>
diff --git a/mm/compaction.c b/mm/compaction.c
index 771775d..0656759 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -431,6 +431,24 @@ static bool suitable_migration_target(struct page *page)
}
/*
+ * We scan the zone in a circular fashion, starting at
+ * zone->compact_cached_free_pfn. Be careful not to skip if
+ * one compacting thread has just wrapped back to the end of the
+ * zone, but another thread has not.
+ */
+static bool compaction_may_skip(struct zone *zone,
+ struct compact_control *cc)
+{
+ if (!cc->wrapped && zone->compact_cached_free_pfn < cc->start_free_pfn)
+ return true;
+
+ if (cc->wrapped && zone->compact_cached_free_pfn > cc->start_free_pfn)
+ return true;
+
+ return false;
+}
+
+/*
* Based on information in the current compact_control, find blocks
* suitable for isolating free pages from and then isolate them.
*/
@@ -471,13 +489,9 @@ static void isolate_freepages(struct zone *zone,
/*
* Skip ahead if another thread is compacting in the area
- * simultaneously. If we wrapped around, we can only skip
- * ahead if zone->compact_cached_free_pfn also wrapped to
- * above our starting point.
+ * simultaneously, and has finished with this page block.
*/
- if (cc->order > 0 && (!cc->wrapped ||
- zone->compact_cached_free_pfn >
- cc->start_free_pfn))
+ if (cc->order > 0 && compaction_may_skip(zone, cc))
pfn = min(pfn, zone->compact_cached_free_pfn);
if (!pfn_valid(pfn))
next prev parent reply other threads:[~2012-09-13 19:54 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-16 10:47 [Qemu-devel] Windows slow boot: contractor wanted Richard Davies
2012-08-16 11:39 ` Avi Kivity
2012-08-17 12:36 ` Richard Davies
2012-08-17 13:02 ` Robert Vineyard
2012-08-18 14:44 ` Richard Davies
2012-08-19 5:02 ` Brian Jackson
2012-08-20 8:16 ` Richard Davies
2012-08-19 8:40 ` Avi Kivity
2012-08-19 8:51 ` Richard Davies
2012-08-19 14:04 ` Avi Kivity
2012-08-20 13:56 ` Richard Davies
2012-08-21 9:00 ` Avi Kivity
2012-08-21 15:21 ` Richard Davies
2012-08-21 15:39 ` Troy Benjegerdes
2012-08-22 9:08 ` Avi Kivity
2012-08-22 12:40 ` Richard Davies
2012-08-22 12:44 ` Avi Kivity
2012-08-22 14:41 ` Richard Davies
2012-08-22 14:53 ` Avi Kivity
2012-08-22 15:26 ` Richard Davies
2012-08-22 17:22 ` Troy Benjegerdes
2012-08-25 17:51 ` Richard Davies
2012-08-22 15:21 ` Rik van Riel
2012-08-22 15:34 ` Richard Davies
2012-08-25 17:45 ` Richard Davies
2012-08-25 18:11 ` Rik van Riel
2012-08-26 10:58 ` Richard Davies
2012-09-06 9:20 ` Richard Davies
2012-09-12 10:56 ` [Qemu-devel] Windows VM slow boot Richard Davies
2012-09-12 12:25 ` Mel Gorman
2012-09-12 16:46 ` Richard Davies
2012-09-13 9:50 ` Mel Gorman
2012-09-13 19:47 ` [Qemu-devel] [PATCH 1/2] Revert "mm: have order > 0 compaction start near a pageblock with free pages" Rik van Riel
2012-09-13 19:48 ` [Qemu-devel] [PATCH 2/2] make the compaction "skip ahead" logic robust Rik van Riel
2012-09-13 19:54 ` Rik van Riel [this message]
2012-09-15 15:55 ` [Qemu-devel] [PATCH -v2 " Richard Davies
2012-09-16 19:12 ` Richard Davies
2012-09-17 12:26 ` Mel Gorman
2012-09-18 8:14 ` Richard Davies
2012-09-18 11:21 ` Mel Gorman
2012-09-18 17:58 ` Richard Davies
2012-09-17 13:50 ` Rik van Riel
2012-09-17 14:07 ` Mel Gorman
2012-08-16 14:10 ` [Qemu-devel] Windows slow boot: contractor wanted Benoît Canet
2012-08-16 15:53 ` Troy Benjegerdes
2012-09-18 15:12 ` [Qemu-devel] Windows slow boot Michael Tokarev
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=20120913155450.7634148f@cuia.bos.redhat.com \
--to=riel@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=richard@arachsys.com \
--cc=shli@kernel.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;
as well as URLs for NNTP newsgroup(s).