* [PATCH] mm: compaction: Do not accidentally skip pageblocks in the migrate scanner
@ 2012-12-20 14:22 Mel Gorman
2012-12-20 22:45 ` Rik van Riel
0 siblings, 1 reply; 2+ messages in thread
From: Mel Gorman @ 2012-12-20 14:22 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, linux-kernel
Compaction uses the ALIGN macro incorrectly with the migrate scanner by
adding pageblock_nr_pages to a PFN. It happened to work when initially
implemented as the starting PFN was also aligned but with caching restarts
and isolating in smaller chunks this is no longer always true. The impact is
that the migrate scanner scans outside its current pageblock. As pfn_valid()
is still checked properly it does not cause any failure and the impact
of the bug is that in some cases it will scan more than necessary when
it crosses a page boundary but by no more than COMPACT_CLUSTER_MAX. It
is highly unlikely this is even measurable but it's still wrong so this
patch addresses the problem.
Signed-off-by: Mel Gorman <mgorman@suse.de>
---
mm/compaction.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mm/compaction.c b/mm/compaction.c
index 9eef558..cad98f6 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -630,8 +630,7 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc,
continue;
next_pageblock:
- low_pfn += pageblock_nr_pages;
- low_pfn = ALIGN(low_pfn, pageblock_nr_pages) - 1;
+ low_pfn = ALIGN(low_pfn + 1, pageblock_nr_pages) - 1;
last_pageblock_nr = pageblock_nr;
}
@@ -802,7 +801,7 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
low_pfn = max(cc->migrate_pfn, zone->zone_start_pfn);
/* Only scan within a pageblock boundary */
- end_pfn = ALIGN(low_pfn + pageblock_nr_pages, pageblock_nr_pages);
+ end_pfn = ALIGN(low_pfn + 1, pageblock_nr_pages);
/* Do not cross the free scanner or scan within a memory hole */
if (end_pfn > cc->free_pfn || !pfn_valid(low_pfn)) {
--
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>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm: compaction: Do not accidentally skip pageblocks in the migrate scanner
2012-12-20 14:22 [PATCH] mm: compaction: Do not accidentally skip pageblocks in the migrate scanner Mel Gorman
@ 2012-12-20 22:45 ` Rik van Riel
0 siblings, 0 replies; 2+ messages in thread
From: Rik van Riel @ 2012-12-20 22:45 UTC (permalink / raw)
To: Mel Gorman; +Cc: Andrew Morton, linux-mm, linux-kernel
On 12/20/2012 09:22 AM, Mel Gorman wrote:
> Compaction uses the ALIGN macro incorrectly with the migrate scanner by
> adding pageblock_nr_pages to a PFN. It happened to work when initially
> implemented as the starting PFN was also aligned but with caching restarts
> and isolating in smaller chunks this is no longer always true. The impact is
> that the migrate scanner scans outside its current pageblock. As pfn_valid()
> is still checked properly it does not cause any failure and the impact
> of the bug is that in some cases it will scan more than necessary when
> it crosses a page boundary but by no more than COMPACT_CLUSTER_MAX. It
> is highly unlikely this is even measurable but it's still wrong so this
> patch addresses the problem.
>
> Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
--
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-20 22:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-20 14:22 [PATCH] mm: compaction: Do not accidentally skip pageblocks in the migrate scanner Mel Gorman
2012-12-20 22:45 ` Rik van Riel
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).