Skip to content

Commit 59b52f1

Browse files
davidhildenbrandbostrovs
authored andcommitted
xen/balloon: Mark pages PG_offline in balloon_append()
Let's move the __SetPageOffline() call which all callers perform into balloon_append(). In bp_state decrease_reservation(), pages are now marked PG_offline a little later than before, however, this should not matter for XEN. Suggested-by: Boris Ostrovsky <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: Juergen Gross <[email protected]> Cc: Stefano Stabellini <[email protected]> Signed-off-by: David Hildenbrand <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent dde3285 commit 59b52f1

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

drivers/xen/balloon.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ static DECLARE_DELAYED_WORK(balloon_worker, balloon_process);
158158
/* balloon_append: add the given page to the balloon. */
159159
static void balloon_append(struct page *page)
160160
{
161+
__SetPageOffline(page);
162+
161163
/* Lowmem is re-populated first, so highmem pages go at list tail. */
162164
if (PageHighMem(page)) {
163165
list_add_tail(&page->lru, &ballooned_pages);
@@ -372,7 +374,6 @@ static void xen_online_page(struct page *page, unsigned int order)
372374
for (i = 0; i < size; i++) {
373375
p = pfn_to_page(start_pfn + i);
374376
__online_page_set_limits(p);
375-
__SetPageOffline(p);
376377
balloon_append(p);
377378
}
378379
mutex_unlock(&balloon_mutex);
@@ -466,7 +467,6 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp)
466467
state = BP_EAGAIN;
467468
break;
468469
}
469-
__SetPageOffline(page);
470470
adjust_managed_page_count(page, -1);
471471
xenmem_reservation_scrub_page(page);
472472
list_add(&page->lru, &pages);
@@ -648,10 +648,8 @@ void free_xenballooned_pages(int nr_pages, struct page **pages)
648648
mutex_lock(&balloon_mutex);
649649

650650
for (i = 0; i < nr_pages; i++) {
651-
if (pages[i]) {
652-
__SetPageOffline(pages[i]);
651+
if (pages[i])
653652
balloon_append(pages[i]);
654-
}
655653
}
656654

657655
balloon_stats.target_unpopulated -= nr_pages;
@@ -669,7 +667,6 @@ static void __init balloon_add_region(unsigned long start_pfn,
669667
unsigned long pages)
670668
{
671669
unsigned long pfn, extra_pfn_end;
672-
struct page *page;
673670

674671
/*
675672
* If the amount of usable memory has been limited (e.g., with
@@ -679,12 +676,10 @@ static void __init balloon_add_region(unsigned long start_pfn,
679676
extra_pfn_end = min(max_pfn, start_pfn + pages);
680677

681678
for (pfn = start_pfn; pfn < extra_pfn_end; pfn++) {
682-
page = pfn_to_page(pfn);
683679
/* totalram_pages and totalhigh_pages do not
684680
include the boot-time balloon extension, so
685681
don't subtract from it. */
686-
__SetPageOffline(page);
687-
balloon_append(page);
682+
balloon_append(pfn_to_page(pfn));
688683
}
689684

690685
balloon_stats.total_pages += extra_pfn_end - start_pfn;

0 commit comments

Comments
 (0)