- hibernate_page_list_t * page_list = NULL;
- hibernate_page_list_t * page_list_wired = NULL;
- hibernate_page_list_t * page_list_pal = NULL;
- uint32_t gobble_count;
-
- *page_list_ret = NULL;
- *page_list_wired_ret = NULL;
- *page_list_pal_ret = NULL;
-
- if (vmflush && dp_isssd)
- hibernate_flush_memory();
-
- page_list = hibernate_page_list_allocate(TRUE);
- if (!page_list)
- return (KERN_RESOURCE_SHORTAGE);
- page_list_wired = hibernate_page_list_allocate(FALSE);
- if (!page_list_wired)
- {
- kfree(page_list, page_list->list_size);
- return (KERN_RESOURCE_SHORTAGE);
- }
- page_list_pal = hibernate_page_list_allocate(FALSE);
- if (!page_list_pal)
- {
- kfree(page_list, page_list->list_size);
- kfree(page_list_wired, page_list_wired->list_size);
- return (KERN_RESOURCE_SHORTAGE);
- }
-
- // pages we could force out to reduce hibernate image size
- gobble_count = (uint32_t)((((uint64_t) page_list->page_count) * ((uint64_t) free_page_ratio)) / 100);
-
- // no failures hereafter
-
- hibernate_processor_setup(header);
-
- if (gobble_count)
- hibernate_gobble_pages(gobble_count, free_page_time);
-
- HIBLOG("hibernate_alloc_pages act %d, inact %d, anon %d, throt %d, spec %d, wire %d, wireinit %d\n",
- vm_page_active_count, vm_page_inactive_count,
- vm_page_anonymous_count, vm_page_throttled_count, vm_page_speculative_count,
- vm_page_wire_count, vm_page_wire_count_initial);