Andrea, On Thu, Apr 08, 2010 at 03:51:39AM +0200, Andrea Arcangeli wrote: > +static unsigned long isolate_migratepages(struct zone *zone, > + struct compact_control *cc) > +{ > + unsigned long low_pfn, end_pfn; > + struct list_head *migratelist = &cc->migratepages; > + > + /* Do not scan outside zone boundaries */ > + 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); > + > + /* Do not cross the free scanner or scan within a memory hole */ > + if (end_pfn > cc->free_pfn || !pfn_valid(low_pfn)) { > + cc->migrate_pfn = end_pfn; > + return 0; > + } > + > + /* > + * Ensure that there are not too many pages isolated from the LRU > + * list by either parallel reclaimers or compaction. If there are, > + * delay for some time until fewer pages are isolated > + */ > + while (unlikely(too_many_isolated(zone))) { > + congestion_wait(BLK_RW_ASYNC, HZ/10); > + > + if (fatal_signal_pending(current)) > + return 0; > + } > + > + /* Time to isolate some pages for migration */ > + spin_lock_irq(&zone->lru_lock); > + for (; low_pfn < end_pfn; low_pfn++) { > + struct page *page; > + if (!pfn_valid_within(low_pfn)) > + continue; > + > + /* Get the page and skip if free */ > + page = pfn_to_page(low_pfn); > + if (PageBuddy(page)) { Should this be if (PageBuddy(page) || PageTransHuge(page)) { > + low_pfn += (1 << page_order(page)) - 1; > + continue; > + } instead? > + > + /* Try isolate the page */ > + if (__isolate_lru_page(page, ISOLATE_BOTH, 0) != 0) > + continue; > + > + /* Successfully isolated */ > + del_page_from_lru_list(zone, page, page_lru(page)); > + list_add(&page->lru, migratelist); > + mem_cgroup_del_lru(page); > + cc->nr_migratepages++; > + > + /* Avoid isolating too much */ > + if (cc->nr_migratepages == COMPACT_CLUSTER_MAX) > + break; > + } > + > + acct_isolated(zone, cc); > + > + spin_unlock_irq(&zone->lru_lock); > + cc->migrate_pfn = low_pfn; > + > + return cc->nr_migratepages; -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>