Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/xen/balloon/balloon.c
Show First 20 Lines • Show All 222 Lines • ▼ Show 20 Lines | decrease_reservation(unsigned long nr_pages) | ||||
}; | }; | ||||
mtx_assert(&balloon_mutex, MA_OWNED); | mtx_assert(&balloon_mutex, MA_OWNED); | ||||
if (nr_pages > nitems(frame_list)) | if (nr_pages > nitems(frame_list)) | ||||
nr_pages = nitems(frame_list); | nr_pages = nitems(frame_list); | ||||
for (i = 0; i < nr_pages; i++) { | for (i = 0; i < nr_pages; i++) { | ||||
if ((page = vm_page_alloc(NULL, 0, | if ((page = vm_page_alloc_noobj(VM_ALLOC_NORMAL | | ||||
VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | | |||||
VM_ALLOC_ZERO)) == NULL) { | VM_ALLOC_ZERO)) == NULL) { | ||||
nr_pages = i; | nr_pages = i; | ||||
need_sleep = 1; | need_sleep = 1; | ||||
break; | break; | ||||
} | |||||
if ((page->flags & PG_ZERO) == 0) { | |||||
/* | |||||
* Zero the page, or else we might be leaking | |||||
* important data to other domains on the same | |||||
* host. Xen doesn't scrub ballooned out memory | |||||
* pages, the guest is in charge of making | |||||
* sure that no information is leaked. | |||||
*/ | |||||
pmap_zero_page(page); | |||||
} | } | ||||
alc: As an aside, it's curious that we specify "nodump" in the virtio driver but not here. | |||||
Done Inline ActionsI can't see a reason for virtio to specify NODUMP: it doesn't call dump_add_page() and I can't see how or why virtio balloon pages would ever be mapped. markj: I can't see a reason for virtio to specify NODUMP: it doesn't call dump_add_page() and I can't… | |||||
Not Done Inline ActionsYes, you are right. There is no reason for the virtio balloon driver to pass the "no dump" flag. alc: Yes, you are right. There is no reason for the virtio balloon driver to pass the "no dump"… | |||||
frame_list[i] = (VM_PAGE_TO_PHYS(page) >> PAGE_SHIFT); | frame_list[i] = (VM_PAGE_TO_PHYS(page) >> PAGE_SHIFT); | ||||
TAILQ_INSERT_HEAD(&ballooned_pages, page, plinks.q); | TAILQ_INSERT_HEAD(&ballooned_pages, page, plinks.q); | ||||
bs.balloon_low++; | bs.balloon_low++; | ||||
} | } | ||||
set_xen_guest_handle(reservation.extent_start, frame_list); | set_xen_guest_handle(reservation.extent_start, frame_list); | ||||
reservation.nr_extents = nr_pages; | reservation.nr_extents = nr_pages; | ||||
▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines |
As an aside, it's curious that we specify "nodump" in the virtio driver but not here.