Lines Matching refs:ctl

651 				     struct vmballoon_ctl *ctl,  in vmballoon_alloc_page_list()  argument
663 if (!list_empty(&ctl->prealloc_pages)) { in vmballoon_alloc_page_list()
664 page = list_first_entry(&ctl->prealloc_pages, in vmballoon_alloc_page_list()
668 if (ctl->page_size == VMW_BALLOON_2M_PAGE) in vmballoon_alloc_page_list()
675 ctl->page_size); in vmballoon_alloc_page_list()
680 list_add(&page->lru, &ctl->pages); in vmballoon_alloc_page_list()
686 ctl->page_size); in vmballoon_alloc_page_list()
690 ctl->n_pages = i; in vmballoon_alloc_page_list()
692 return req_n_pages == ctl->n_pages ? 0 : -ENOMEM; in vmballoon_alloc_page_list()
844 static int vmballoon_lock(struct vmballoon *b, struct vmballoon_ctl *ctl) in vmballoon_lock() argument
850 num_pages = ctl->n_pages; in vmballoon_lock()
858 list_for_each_entry(page, &ctl->pages, lru) in vmballoon_lock()
861 batch_status = vmballoon_lock_op(b, ctl->n_pages, ctl->page_size, in vmballoon_lock()
862 ctl->op); in vmballoon_lock()
882 if (!vmballoon_handle_one_result(b, page, ctl->page_size, in vmballoon_lock()
890 list_move(&page->lru, &ctl->refused_pages); in vmballoon_lock()
891 ctl->n_pages--; in vmballoon_lock()
892 ctl->n_refused_pages++; in vmballoon_lock()
930 struct vmballoon_ctl *ctl) in vmballoon_release_refused_pages() argument
933 ctl->page_size); in vmballoon_release_refused_pages()
935 vmballoon_release_page_list(&ctl->refused_pages, &ctl->n_refused_pages, in vmballoon_release_refused_pages()
936 ctl->page_size); in vmballoon_release_refused_pages()
1071 static void vmballoon_split_refused_pages(struct vmballoon_ctl *ctl) in vmballoon_split_refused_pages() argument
1076 order = vmballoon_page_order(ctl->page_size); in vmballoon_split_refused_pages()
1078 list_for_each_entry_safe(page, tmp, &ctl->refused_pages, lru) { in vmballoon_split_refused_pages()
1082 list_add(&page[i].lru, &ctl->prealloc_pages); in vmballoon_split_refused_pages()
1084 ctl->n_refused_pages = 0; in vmballoon_split_refused_pages()
1095 struct vmballoon_ctl ctl = { in vmballoon_inflate() local
1096 .pages = LIST_HEAD_INIT(ctl.pages), in vmballoon_inflate()
1097 .refused_pages = LIST_HEAD_INIT(ctl.refused_pages), in vmballoon_inflate()
1098 .prealloc_pages = LIST_HEAD_INIT(ctl.prealloc_pages), in vmballoon_inflate()
1107 VM_BUG_ON(!list_empty(&ctl.pages)); in vmballoon_inflate()
1108 VM_BUG_ON(ctl.n_pages != 0); in vmballoon_inflate()
1110 page_in_frames = vmballoon_page_in_frames(ctl.page_size); in vmballoon_inflate()
1117 alloc_error = vmballoon_alloc_page_list(b, &ctl, in vmballoon_inflate()
1121 lock_error = vmballoon_lock(b, &ctl); in vmballoon_inflate()
1131 atomic64_add(ctl.n_pages * page_in_frames, &b->size); in vmballoon_inflate()
1133 vmballoon_enqueue_page_list(b, &ctl.pages, &ctl.n_pages, in vmballoon_inflate()
1134 ctl.page_size); in vmballoon_inflate()
1141 ctl.n_refused_pages >= VMW_BALLOON_MAX_REFUSED) { in vmballoon_inflate()
1142 if (ctl.page_size == VMW_BALLOON_4K_PAGE) in vmballoon_inflate()
1149 vmballoon_split_refused_pages(&ctl); in vmballoon_inflate()
1150 ctl.page_size--; in vmballoon_inflate()
1161 if (ctl.n_refused_pages != 0) in vmballoon_inflate()
1162 vmballoon_release_refused_pages(b, &ctl); in vmballoon_inflate()
1164 vmballoon_release_page_list(&ctl.prealloc_pages, NULL, ctl.page_size); in vmballoon_inflate()
1184 struct vmballoon_ctl ctl = { in vmballoon_deflate() local
1185 .pages = LIST_HEAD_INIT(ctl.pages), in vmballoon_deflate()
1186 .refused_pages = LIST_HEAD_INIT(ctl.refused_pages), in vmballoon_deflate()
1198 page_in_frames = vmballoon_page_in_frames(ctl.page_size); in vmballoon_deflate()
1200 VM_BUG_ON(!list_empty(&ctl.pages)); in vmballoon_deflate()
1201 VM_BUG_ON(ctl.n_pages); in vmballoon_deflate()
1202 VM_BUG_ON(!list_empty(&ctl.refused_pages)); in vmballoon_deflate()
1203 VM_BUG_ON(ctl.n_refused_pages); in vmballoon_deflate()
1226 vmballoon_dequeue_page_list(b, &ctl.pages, &ctl.n_pages, in vmballoon_deflate()
1227 ctl.page_size, to_deflate_pages); in vmballoon_deflate()
1233 tried_frames += ctl.n_pages * page_in_frames; in vmballoon_deflate()
1243 vmballoon_lock(b, &ctl); in vmballoon_deflate()
1251 deflated_all = (ctl.n_pages == to_deflate_pages); in vmballoon_deflate()
1254 n_unlocked_frames = ctl.n_pages * page_in_frames; in vmballoon_deflate()
1259 ctl.page_size, ctl.n_pages); in vmballoon_deflate()
1262 vmballoon_release_page_list(&ctl.pages, &ctl.n_pages, in vmballoon_deflate()
1263 ctl.page_size); in vmballoon_deflate()
1266 vmballoon_enqueue_page_list(b, &ctl.refused_pages, in vmballoon_deflate()
1267 &ctl.n_refused_pages, in vmballoon_deflate()
1268 ctl.page_size); in vmballoon_deflate()
1272 if (ctl.page_size == b->max_page_size) in vmballoon_deflate()
1274 ctl.page_size++; in vmballoon_deflate()