page_alloc: fix invalid watermark check on a negative value
[sfrench/cifs-2.6.git] / mm / page_isolation.c
index 6021f8444b5a2e483c8e20deea84ad548a17ae39..9d73dc38e3d75cdc6ec5a1efc3cbc178dbc89464 100644 (file)
@@ -286,6 +286,8 @@ __first_valid_page(unsigned long pfn, unsigned long nr_pages)
  * @flags:                     isolation flags
  * @gfp_flags:                 GFP flags used for migrating pages
  * @isolate_before:    isolate the pageblock before the boundary_pfn
+ * @skip_isolation:    the flag to skip the pageblock isolation in second
+ *                     isolate_single_pageblock()
  *
  * Free and in-use pages can be as big as MAX_ORDER-1 and contain more than one
  * pageblock. When not all pageblocks within a page are isolated at the same
@@ -385,9 +387,9 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags,
                 * above do the rest. If migration is not possible, just fail.
                 */
                if (PageCompound(page)) {
-                       unsigned long nr_pages = compound_nr(page);
                        struct page *head = compound_head(page);
                        unsigned long head_pfn = page_to_pfn(head);
+                       unsigned long nr_pages = compound_nr(head);
 
                        if (head_pfn + nr_pages <= boundary_pfn) {
                                pfn = head_pfn + nr_pages;