[PATCH 4/5] lumpy: update commentry on subtle comparisons and rounding assumptions

From: Andy Whitcroft
Date: Tue Feb 27 2007 - 14:36:20 EST



We have a number of subtle comparisons when scanning a block, and
we make use of a lot of buddy mem_map guarentees. Add commentary about
each.

Signed-off-by: Andy Whitcroft <apw@xxxxxxxxxxxx>
---
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2bfad79..bef7e92 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -709,7 +709,11 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
/*
* Attempt to take all pages in the order aligned region
* surrounding the tag page. Only take those pages of
- * the same active state as that tag page.
+ * the same active state as that tag page. We may safely
+ * round the target page pfn down to the requested order
+ * as the mem_map is guarenteed valid out to MAX_ORDER,
+ * where that page is in a different zone we will detect
+ * it from its zone id and abort this block scan.
*/
zone_id = page_zone_id(page);
page_pfn = page_to_pfn(page);
@@ -718,12 +722,15 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
for (; pfn < end_pfn; pfn++) {
struct page *cursor_page;

+ /* The target page is in the block, ignore it. */
if (unlikely(pfn == page_pfn))
continue;
+ /* Avoid holes within the zone. */
if (unlikely(!pfn_valid(pfn)))
break;

cursor_page = pfn_to_page(pfn);
+ /* Check that we have not crossed a zone boundary. */
if (unlikely(page_zone_id(cursor_page) != zone_id))
continue;
scan++;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/