diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index be9028d38c..0a0ebc1598 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1153,11 +1153,13 @@ static int reserve_offlined_page(struct page_info *head) next_order = cur_order = 0; + /* Attempt to grow the order (size) of the buddy as much as possible. */ while ( cur_order < head_order ) { next_order = cur_order + 1; - if ( (cur_head + (1 << next_order)) >= (head + ( 1 << head_order)) ) + /* Do not grow to next_order if it would go beyond the buddy. */ + if ( (cur_head + (1 << next_order)) > (head + (1 << head_order)) ) goto merge; /* Do not grow to next_order if cur_head is not aligned to it. */