12 static void set_pageblock_isolate(
struct page *
page)
18 page_zone(page)->nr_pageblock_isolate++;
22 static void restore_pageblock_isolate(
struct page *page,
int migratetype)
28 BUG_ON(zone->nr_pageblock_isolate <= 0);
30 zone->nr_pageblock_isolate--;
36 unsigned long flags, pfn;
41 zone = page_zone(page);
62 notifier_ret = notifier_to_errno(notifier_ret);
80 int migratetype = get_pageblock_migratetype(page);
82 set_pageblock_isolate(page);
85 __mod_zone_freepage_state(zone, -nr_pages, migratetype);
88 spin_unlock_irqrestore(&zone->
lock, flags);
97 unsigned long flags, nr_pages;
99 zone = page_zone(page);
104 __mod_zone_freepage_state(zone, nr_pages, migratetype);
105 restore_pageblock_isolate(page, migratetype);
107 spin_unlock_irqrestore(&zone->
lock, flags);
110 static inline struct page *
111 __first_valid_page(
unsigned long pfn,
unsigned long nr_pages)
114 for (i = 0; i < nr_pages; i++)
137 unsigned migratetype)
140 unsigned long undo_pfn;
146 for (pfn = start_pfn;
157 for (pfn = start_pfn;
169 unsigned migratetype)
175 for (pfn = start_pfn;
193 __test_page_isolated_in_pageblock(
unsigned long pfn,
unsigned long end_pfn)
197 while (pfn < end_pfn) {
203 if (PageBuddy(page)) {
212 struct page *end_page;
214 end_page = page + (1 << page_order(page)) - 1;
218 pfn += 1 << page_order(page);
220 else if (page_count(page) == 0 &&
233 unsigned long pfn,
flags;
248 page = __first_valid_page(start_pfn, end_pfn - start_pfn);
249 if ((pfn < end_pfn) || !page)
252 zone = page_zone(page);
254 ret = __test_page_isolated_in_pageblock(start_pfn, end_pfn);
255 spin_unlock_irqrestore(&zone->
lock, flags);
256 return ret ? 0 : -
EBUSY;
264 if (PageHighMem(page))