• Home
  • Raw
  • Download

Lines Matching +full:charge +full:- +full:current +full:- +full:limit +full:- +full:mapping

1 // SPDX-License-Identifier: GPL-2.0-only
84 return page_private(head + 4) == -1UL; in PageHugeFreed()
89 set_page_private(head + 4, -1UL); in SetPageHugeFreed()
102 bool free = (spool->count == 0) && (spool->used_hpages == 0); in unlock_or_release_subpool()
104 spin_unlock(&spool->lock); in unlock_or_release_subpool()
110 if (spool->min_hpages != -1) in unlock_or_release_subpool()
111 hugetlb_acct_memory(spool->hstate, in unlock_or_release_subpool()
112 -spool->min_hpages); in unlock_or_release_subpool()
126 spin_lock_init(&spool->lock); in hugepage_new_subpool()
127 spool->count = 1; in hugepage_new_subpool()
128 spool->max_hpages = max_hpages; in hugepage_new_subpool()
129 spool->hstate = h; in hugepage_new_subpool()
130 spool->min_hpages = min_hpages; in hugepage_new_subpool()
132 if (min_hpages != -1 && hugetlb_acct_memory(h, min_hpages)) { in hugepage_new_subpool()
136 spool->rsv_hpages = min_hpages; in hugepage_new_subpool()
143 spin_lock(&spool->lock); in hugepage_put_subpool()
144 BUG_ON(!spool->count); in hugepage_put_subpool()
145 spool->count--; in hugepage_put_subpool()
151 * Return -ENOMEM if there are not enough resources to satisfy the
165 spin_lock(&spool->lock); in hugepage_subpool_get_pages()
167 if (spool->max_hpages != -1) { /* maximum size accounting */ in hugepage_subpool_get_pages()
168 if ((spool->used_hpages + delta) <= spool->max_hpages) in hugepage_subpool_get_pages()
169 spool->used_hpages += delta; in hugepage_subpool_get_pages()
171 ret = -ENOMEM; in hugepage_subpool_get_pages()
177 if (spool->min_hpages != -1 && spool->rsv_hpages) { in hugepage_subpool_get_pages()
178 if (delta > spool->rsv_hpages) { in hugepage_subpool_get_pages()
183 ret = delta - spool->rsv_hpages; in hugepage_subpool_get_pages()
184 spool->rsv_hpages = 0; in hugepage_subpool_get_pages()
187 spool->rsv_hpages -= delta; in hugepage_subpool_get_pages()
192 spin_unlock(&spool->lock); in hugepage_subpool_get_pages()
210 spin_lock(&spool->lock); in hugepage_subpool_put_pages()
212 if (spool->max_hpages != -1) /* maximum size accounting */ in hugepage_subpool_put_pages()
213 spool->used_hpages -= delta; in hugepage_subpool_put_pages()
216 if (spool->min_hpages != -1 && spool->used_hpages < spool->min_hpages) { in hugepage_subpool_put_pages()
217 if (spool->rsv_hpages + delta <= spool->min_hpages) in hugepage_subpool_put_pages()
220 ret = spool->rsv_hpages + delta - spool->min_hpages; in hugepage_subpool_put_pages()
222 spool->rsv_hpages += delta; in hugepage_subpool_put_pages()
223 if (spool->rsv_hpages > spool->min_hpages) in hugepage_subpool_put_pages()
224 spool->rsv_hpages = spool->min_hpages; in hugepage_subpool_put_pages()
238 return HUGETLBFS_SB(inode->i_sb)->spool; in subpool_inode()
243 return subpool_inode(file_inode(vma->vm_file)); in subpool_vma()
254 VM_BUG_ON(resv->region_cache_count <= 0); in get_file_region_entry_from_cache()
256 resv->region_cache_count--; in get_file_region_entry_from_cache()
257 nrg = list_first_entry(&resv->region_cache, struct file_region, link); in get_file_region_entry_from_cache()
258 list_del(&nrg->link); in get_file_region_entry_from_cache()
260 nrg->from = from; in get_file_region_entry_from_cache()
261 nrg->to = to; in get_file_region_entry_from_cache()
270 nrg->reservation_counter = rg->reservation_counter; in copy_hugetlb_cgroup_uncharge_info()
271 nrg->css = rg->css; in copy_hugetlb_cgroup_uncharge_info()
272 if (rg->css) in copy_hugetlb_cgroup_uncharge_info()
273 css_get(rg->css); in copy_hugetlb_cgroup_uncharge_info()
285 nrg->reservation_counter = in record_hugetlb_cgroup_uncharge_info()
286 &h_cg->rsvd_hugepage[hstate_index(h)]; in record_hugetlb_cgroup_uncharge_info()
287 nrg->css = &h_cg->css; in record_hugetlb_cgroup_uncharge_info()
289 * The caller will hold exactly one h_cg->css reference for the in record_hugetlb_cgroup_uncharge_info()
294 * exactly one h_cg->css reference, we should do css_get for in record_hugetlb_cgroup_uncharge_info()
298 css_get(&h_cg->css); in record_hugetlb_cgroup_uncharge_info()
299 if (!resv->pages_per_hpage) in record_hugetlb_cgroup_uncharge_info()
300 resv->pages_per_hpage = pages_per_huge_page(h); in record_hugetlb_cgroup_uncharge_info()
304 VM_BUG_ON(resv->pages_per_hpage != pages_per_huge_page(h)); in record_hugetlb_cgroup_uncharge_info()
306 nrg->reservation_counter = NULL; in record_hugetlb_cgroup_uncharge_info()
307 nrg->css = NULL; in record_hugetlb_cgroup_uncharge_info()
315 if (rg->css) in put_uncharge_info()
316 css_put(rg->css); in put_uncharge_info()
325 rg->reservation_counter == org->reservation_counter && in has_same_uncharge_info()
326 rg->css == org->css; in has_same_uncharge_info()
338 if (&prg->link != &resv->regions && prg->to == rg->from && in coalesce_file_region()
340 prg->to = rg->to; in coalesce_file_region()
342 list_del(&rg->link); in coalesce_file_region()
350 if (&nrg->link != &resv->regions && nrg->from == rg->to && in coalesce_file_region()
352 nrg->from = rg->from; in coalesce_file_region()
354 list_del(&rg->link); in coalesce_file_region()
361 * Must be called with resv->lock held.
373 struct list_head *head = &resv->regions; in add_reservation_in_range()
381 * [last_accounted_offset, rg->from), at every iteration, with some in add_reservation_in_range()
386 if (rg->from < f) { in add_reservation_in_range()
390 if (rg->to > last_accounted_offset) in add_reservation_in_range()
391 last_accounted_offset = rg->to; in add_reservation_in_range()
398 if (rg->from > t) in add_reservation_in_range()
401 /* Add an entry for last_accounted_offset -> rg->from, and in add_reservation_in_range()
404 if (rg->from > last_accounted_offset) { in add_reservation_in_range()
405 add += rg->from - last_accounted_offset; in add_reservation_in_range()
408 resv, last_accounted_offset, rg->from); in add_reservation_in_range()
411 list_add(&nrg->link, rg->link.prev); in add_reservation_in_range()
417 last_accounted_offset = rg->to; in add_reservation_in_range()
424 add += t - last_accounted_offset; in add_reservation_in_range()
429 list_add(&nrg->link, rg->link.prev); in add_reservation_in_range()
439 /* Must be called with resv->lock acquired. Will drop lock to allocate entries.
443 __must_hold(&resv->lock) in allocate_file_region_entries()
462 while (resv->region_cache_count < in allocate_file_region_entries()
463 (resv->adds_in_progress + regions_needed)) { in allocate_file_region_entries()
464 to_allocate = resv->adds_in_progress + regions_needed - in allocate_file_region_entries()
465 resv->region_cache_count; in allocate_file_region_entries()
471 VM_BUG_ON(resv->region_cache_count < resv->adds_in_progress); in allocate_file_region_entries()
473 spin_unlock(&resv->lock); in allocate_file_region_entries()
478 list_add(&trg->link, &allocated_regions); in allocate_file_region_entries()
481 spin_lock(&resv->lock); in allocate_file_region_entries()
483 list_splice(&allocated_regions, &resv->region_cache); in allocate_file_region_entries()
484 resv->region_cache_count += to_allocate; in allocate_file_region_entries()
491 list_del(&rg->link); in allocate_file_region_entries()
494 return -ENOMEM; in allocate_file_region_entries()
509 * this operation and we were not able to allocate, it returns -ENOMEM.
520 spin_lock(&resv->lock); in region_add()
537 resv->region_cache_count < in region_add()
538 resv->adds_in_progress + in region_add()
539 (actual_regions_needed - in_regions_needed)) { in region_add()
543 VM_BUG_ON(t - f <= 1); in region_add()
546 resv, actual_regions_needed - in_regions_needed)) { in region_add()
547 return -ENOMEM; in region_add()
555 resv->adds_in_progress -= in_regions_needed; in region_add()
557 spin_unlock(&resv->lock); in region_add()
574 * resv->adds_in_progress. This value needs to be provided to a follow up call
579 * zero. -ENOMEM is returned if a new file_region structure or cache entry
587 spin_lock(&resv->lock); in region_chg()
597 return -ENOMEM; in region_chg()
599 resv->adds_in_progress += *out_regions_needed; in region_chg()
601 spin_unlock(&resv->lock); in region_chg()
621 spin_lock(&resv->lock); in region_abort()
622 VM_BUG_ON(!resv->region_cache_count); in region_abort()
623 resv->adds_in_progress -= regions_needed; in region_abort()
624 spin_unlock(&resv->lock); in region_abort()
636 * be allocated. If the allocation fails, -ENOMEM will be returned.
638 * a region and possibly return -ENOMEM. Callers specifying
639 * t == LONG_MAX do not need to check for -ENOMEM error.
643 struct list_head *head = &resv->regions; in region_del()
649 spin_lock(&resv->lock); in region_del()
658 if (rg->to <= f && (rg->to != rg->from || rg->to != f)) in region_del()
661 if (rg->from >= t) in region_del()
664 if (f > rg->from && t < rg->to) { /* Must split region */ in region_del()
670 resv->region_cache_count > resv->adds_in_progress) { in region_del()
671 nrg = list_first_entry(&resv->region_cache, in region_del()
674 list_del(&nrg->link); in region_del()
675 resv->region_cache_count--; in region_del()
679 spin_unlock(&resv->lock); in region_del()
682 return -ENOMEM; in region_del()
686 del += t - f; in region_del()
688 resv, rg, t - f, false); in region_del()
691 nrg->from = t; in region_del()
692 nrg->to = rg->to; in region_del()
696 INIT_LIST_HEAD(&nrg->link); in region_del()
699 rg->to = f; in region_del()
701 list_add(&nrg->link, &rg->link); in region_del()
706 if (f <= rg->from && t >= rg->to) { /* Remove entire region */ in region_del()
707 del += rg->to - rg->from; in region_del()
709 rg->to - rg->from, true); in region_del()
710 list_del(&rg->link); in region_del()
715 if (f <= rg->from) { /* Trim beginning of region */ in region_del()
717 t - rg->from, false); in region_del()
719 del += t - rg->from; in region_del()
720 rg->from = t; in region_del()
723 rg->to - f, false); in region_del()
725 del += rg->to - f; in region_del()
726 rg->to = f; in region_del()
730 spin_unlock(&resv->lock); in region_del()
770 struct list_head *head = &resv->regions; in region_count()
774 spin_lock(&resv->lock); in region_count()
780 if (rg->to <= f) in region_count()
782 if (rg->from >= t) in region_count()
785 seg_from = max(rg->from, f); in region_count()
786 seg_to = min(rg->to, t); in region_count()
788 chg += seg_to - seg_from; in region_count()
790 spin_unlock(&resv->lock); in region_count()
797 * the mapping, in pagecache page units; huge pages here.
802 return ((address - vma->vm_start) >> huge_page_shift(h)) + in vma_hugecache_offset()
803 (vma->vm_pgoff >> huge_page_order(h)); in vma_hugecache_offset()
819 if (vma->vm_ops && vma->vm_ops->pagesize) in vma_kernel_pagesize()
820 return vma->vm_ops->pagesize(vma); in vma_kernel_pagesize()
828 * architectures where it differs, an architecture-specific 'strong'
847 * faults in a MAP_PRIVATE mapping. Only the process that called mmap()
855 * The private mapping reservation is represented in a subtly different
856 * manner to a shared mapping. A shared mapping has a region map associated
859 * after the page is instantiated. A private mapping has a region map
866 return (unsigned long)vma->vm_private_data; in get_vma_private_data()
872 vma->vm_private_data = (void *)value; in set_vma_private_data()
882 resv_map->reservation_counter = NULL; in resv_map_set_hugetlb_cgroup_uncharge_info()
883 resv_map->pages_per_hpage = 0; in resv_map_set_hugetlb_cgroup_uncharge_info()
884 resv_map->css = NULL; in resv_map_set_hugetlb_cgroup_uncharge_info()
886 resv_map->reservation_counter = in resv_map_set_hugetlb_cgroup_uncharge_info()
887 &h_cg->rsvd_hugepage[hstate_index(h)]; in resv_map_set_hugetlb_cgroup_uncharge_info()
888 resv_map->pages_per_hpage = pages_per_huge_page(h); in resv_map_set_hugetlb_cgroup_uncharge_info()
889 resv_map->css = &h_cg->css; in resv_map_set_hugetlb_cgroup_uncharge_info()
905 kref_init(&resv_map->refs); in resv_map_alloc()
906 spin_lock_init(&resv_map->lock); in resv_map_alloc()
907 INIT_LIST_HEAD(&resv_map->regions); in resv_map_alloc()
909 resv_map->adds_in_progress = 0; in resv_map_alloc()
913 * re-initialized to the proper values, to indicate that hugetlb cgroup in resv_map_alloc()
914 * reservations are to be un-charged from here. in resv_map_alloc()
918 INIT_LIST_HEAD(&resv_map->region_cache); in resv_map_alloc()
919 list_add(&rg->link, &resv_map->region_cache); in resv_map_alloc()
920 resv_map->region_cache_count = 1; in resv_map_alloc()
928 struct list_head *head = &resv_map->region_cache; in resv_map_release()
936 list_del(&rg->link); in resv_map_release()
940 VM_BUG_ON(resv_map->adds_in_progress); in resv_map_release()
952 * The VERY common case is inode->mapping == &inode->i_data but, in inode_resv_map()
955 return (struct resv_map *)(&inode->i_data)->private_data; in inode_resv_map()
961 if (vma->vm_flags & VM_MAYSHARE) { in vma_resv_map()
962 struct address_space *mapping = vma->vm_file->f_mapping; in vma_resv_map() local
963 struct inode *inode = mapping->host; in vma_resv_map()
976 VM_BUG_ON_VMA(vma->vm_flags & VM_MAYSHARE, vma); in set_vma_resv_map()
985 VM_BUG_ON_VMA(vma->vm_flags & VM_MAYSHARE, vma); in set_vma_resv_flags()
1001 if (!(vma->vm_flags & VM_MAYSHARE)) in reset_vma_resv_huge_pages()
1002 vma->vm_private_data = (void *)0; in reset_vma_resv_huge_pages()
1008 if (vma->vm_flags & VM_NORESERVE) { in vma_has_reserves()
1016 * properly, so add work-around here. in vma_has_reserves()
1018 if (vma->vm_flags & VM_MAYSHARE && chg == 0) in vma_has_reserves()
1025 if (vma->vm_flags & VM_MAYSHARE) { in vma_has_reserves()
1046 * could have been performed on the private mapping. in vma_has_reserves()
1049 * Very Subtle - The value of chg comes from a previous in vma_has_reserves()
1071 list_move(&page->lru, &h->hugepage_freelists[nid]); in enqueue_huge_page()
1072 h->free_huge_pages++; in enqueue_huge_page()
1073 h->free_huge_pages_node[nid]++; in enqueue_huge_page()
1080 bool nocma = !!(current->flags & PF_MEMALLOC_NOCMA); in dequeue_huge_page_node_exact()
1082 list_for_each_entry(page, &h->hugepage_freelists[nid], lru) { in dequeue_huge_page_node_exact()
1089 list_move(&page->lru, &h->hugepage_activelist); in dequeue_huge_page_node_exact()
1092 h->free_huge_pages--; in dequeue_huge_page_node_exact()
1093 h->free_huge_pages_node[nid]--; in dequeue_huge_page_node_exact()
1153 h->free_huge_pages - h->resv_huge_pages == 0) in dequeue_huge_page_vma()
1157 if (avoid_reserve && h->free_huge_pages - h->resv_huge_pages == 0) in dequeue_huge_page_vma()
1165 h->resv_huge_pages--; in dequeue_huge_page_vma()
1178 * nodes_allowed previously, so h->next_node_to_{alloc|free} might
1210 nid = get_valid_node_allowed(h->next_nid_to_alloc, nodes_allowed); in hstate_next_node_to_alloc()
1211 h->next_nid_to_alloc = next_node_allowed(nid, nodes_allowed); in hstate_next_node_to_alloc()
1217 * helper for free_pool_huge_page() - return the previously saved
1228 nid = get_valid_node_allowed(h->next_nid_to_free, nodes_allowed); in hstate_next_node_to_free()
1229 h->next_nid_to_free = next_node_allowed(nid, nodes_allowed); in hstate_next_node_to_free()
1238 nr_nodes--)
1244 nr_nodes--)
1345 h->nr_huge_pages--; in update_and_free_page()
1346 h->nr_huge_pages_node[page_to_nid(page)]--; in update_and_free_page()
1349 subpage->flags &= ~(1 << PG_locked | 1 << PG_error | in update_and_free_page()
1359 * For non-gigantic pages set the destructor to the normal compound in update_and_free_page()
1402 * Test to determine whether the hugepage is "active/in-use" (i.e. being linked
1403 * to hstate->hugepage_activelist.)
1434 return (unsigned long)page[2].mapping == -1U; in PageHugeTemporary()
1439 page[2].mapping = (void *)-1U; in SetPageHugeTemporary()
1444 page[2].mapping = NULL; in ClearPageHugeTemporary()
1463 page->mapping = NULL; in __free_huge_page()
1493 h->resv_huge_pages++; in __free_huge_page()
1496 list_del(&page->lru); in __free_huge_page()
1499 } else if (h->surplus_huge_pages_node[nid]) { in __free_huge_page()
1501 list_del(&page->lru); in __free_huge_page()
1503 h->surplus_huge_pages--; in __free_huge_page()
1504 h->surplus_huge_pages_node[nid]--; in __free_huge_page()
1513 * As free_huge_page() can be called from a non-task context, we have
1518 * be freed and frees them one-by-one. As the page->mapping pointer is
1533 struct page, mapping); in free_hpage_workfn()
1534 node = node->next; in free_hpage_workfn()
1543 * Defer freeing if in non-task context to avoid hugetlb_lock deadlock. in free_huge_page()
1551 if (llist_add((struct llist_node *)&page->mapping, in free_huge_page()
1562 INIT_LIST_HEAD(&page->lru); in prep_new_huge_page()
1567 h->nr_huge_pages++; in prep_new_huge_page()
1568 h->nr_huge_pages_node[nid]++; in prep_new_huge_page()
1586 * boot, it's safer to be consistent with the not-gigantic in prep_compound_gigantic_page()
1600 atomic_set(compound_mapcount_ptr(page), -1); in prep_compound_gigantic_page()
1632 * Find and lock address space (mapping) in write mode.
1640 struct address_space *mapping = page_mapping(hpage); in hugetlb_page_mapping_lock_write() local
1642 if (!mapping) in hugetlb_page_mapping_lock_write()
1643 return mapping; in hugetlb_page_mapping_lock_write()
1645 if (i_mmap_trylock_write(mapping)) in hugetlb_page_mapping_lock_write()
1646 return mapping; in hugetlb_page_mapping_lock_write()
1658 compound_idx = page_to_pfn(page) - page_to_pfn(page_head); in hugetlb_basepage_index()
1660 compound_idx = page - page_head; in hugetlb_basepage_index()
1780 if ((!acct_surplus || h->surplus_huge_pages_node[node]) && in free_pool_huge_page()
1781 !list_empty(&h->hugepage_freelists[node])) { in free_pool_huge_page()
1783 list_entry(h->hugepage_freelists[node].next, in free_pool_huge_page()
1785 list_del(&page->lru); in free_pool_huge_page()
1786 h->free_huge_pages--; in free_pool_huge_page()
1787 h->free_huge_pages_node[node]--; in free_pool_huge_page()
1789 h->surplus_huge_pages--; in free_pool_huge_page()
1790 h->surplus_huge_pages_node[node]--; in free_pool_huge_page()
1803 * nothing for in-use hugepages and non-hugepages.
1806 * -EBUSY: failed to dissolved free hugepages or the hugepage is in-use
1813 int rc = -EBUSY; in dissolve_free_huge_page()
1830 if (h->free_huge_pages - h->resv_huge_pages == 0) in dissolve_free_huge_page()
1842 * Theoretically, we should return -EBUSY when we in dissolve_free_huge_page()
1860 list_del(&head->lru); in dissolve_free_huge_page()
1861 h->free_huge_pages--; in dissolve_free_huge_page()
1862 h->free_huge_pages_node[nid]--; in dissolve_free_huge_page()
1863 h->max_huge_pages--; in dissolve_free_huge_page()
1911 if (h->surplus_huge_pages >= h->nr_overcommit_huge_pages) in alloc_surplus_huge_page()
1927 if (h->surplus_huge_pages >= h->nr_overcommit_huge_pages) { in alloc_surplus_huge_page()
1933 h->surplus_huge_pages++; in alloc_surplus_huge_page()
1934 h->surplus_huge_pages_node[page_to_nid(page)]++; in alloc_surplus_huge_page()
1989 if (h->free_huge_pages - h->resv_huge_pages > 0) { in alloc_huge_page_nodemask()
2035 needed = (h->resv_huge_pages + delta) - h->free_huge_pages; in gather_surplus_pages()
2037 h->resv_huge_pages += delta; in gather_surplus_pages()
2044 ret = -ENOMEM; in gather_surplus_pages()
2054 list_add(&page->lru, &surplus_list); in gather_surplus_pages()
2064 needed = (h->resv_huge_pages + delta) - in gather_surplus_pages()
2065 (h->free_huge_pages + allocated); in gather_surplus_pages()
2085 h->resv_huge_pages += delta; in gather_surplus_pages()
2090 if ((--needed) < 0) in gather_surplus_pages()
2094 * no users -- drop the buddy allocator's reference. in gather_surplus_pages()
2136 * by pre-allocated pages. Only free surplus pages. in return_unused_surplus_pages()
2138 nr_pages = min(unused_resv_pages, h->surplus_huge_pages); in return_unused_surplus_pages()
2146 * on-line nodes with memory and will handle the hstate accounting. in return_unused_surplus_pages()
2152 while (nr_pages--) { in return_unused_surplus_pages()
2153 h->resv_huge_pages--; in return_unused_surplus_pages()
2154 unused_resv_pages--; in return_unused_surplus_pages()
2162 h->resv_huge_pages -= unused_resv_pages; in return_unused_surplus_pages()
2229 if (vma->vm_flags & VM_MAYSHARE) { in __vma_reservation_common()
2242 if (vma->vm_flags & VM_MAYSHARE) in __vma_reservation_common()
2247 * However, a file associated with mapping could have been in __vma_reservation_common()
2250 * Subtle - The reserve map for private mappings has the in __vma_reservation_common()
2355 return ERR_PTR(-ENOMEM); in alloc_huge_page()
2358 * Processes that did not create the mapping will have no in alloc_huge_page()
2360 * that the allocation will not exceed the subpool limit. in alloc_huge_page()
2362 * checked against any subpool limit. in alloc_huge_page()
2368 return ERR_PTR(-ENOSPC); in alloc_huge_page()
2383 /* If this allocation is not consuming a reservation, charge it now. in alloc_huge_page()
2411 h->resv_huge_pages--; in alloc_huge_page()
2414 list_add(&page->lru, &h->hugepage_activelist); in alloc_huge_page()
2444 hugetlb_acct_memory(h, -rsv_adjust); in alloc_huge_page()
2461 return ERR_PTR(-ENOSPC); in alloc_huge_page()
2492 INIT_LIST_HEAD(&m->list); in __alloc_bootmem_huge_page()
2493 list_add(&m->list, &huge_boot_pages); in __alloc_bootmem_huge_page()
2494 m->hstate = h; in __alloc_bootmem_huge_page()
2508 struct hstate *h = m->hstate; in gather_bootmem_prealloc()
2520 * other side-effects, like CommitLimit going negative. in gather_bootmem_prealloc()
2534 * Bit mask controlling how hard we retry per-node allocations. in hugetlb_hstate_alloc_pages()
2546 /* bit mask controlling how hard we retry per-node allocations */ in hugetlb_hstate_alloc_pages()
2550 for (i = 0; i < h->max_huge_pages; ++i) { in hugetlb_hstate_alloc_pages()
2564 if (i < h->max_huge_pages) { in hugetlb_hstate_alloc_pages()
2569 h->max_huge_pages, buf, i); in hugetlb_hstate_alloc_pages()
2570 h->max_huge_pages = i; in hugetlb_hstate_alloc_pages()
2599 pr_info("HugeTLB registered %s page size, pre-allocated %ld pages\n", in report_hugepages()
2600 buf, h->free_huge_pages); in report_hugepages()
2615 struct list_head *freel = &h->hugepage_freelists[i]; in try_to_free_low()
2617 if (count >= h->nr_huge_pages) in try_to_free_low()
2621 list_del(&page->lru); in try_to_free_low()
2623 h->free_huge_pages--; in try_to_free_low()
2624 h->free_huge_pages_node[page_to_nid(page)]--; in try_to_free_low()
2636 * Increment or decrement surplus_huge_pages. Keep node-specific counters
2637 * balanced by operating on them in a round-robin fashion.
2645 VM_BUG_ON(delta != -1 && delta != 1); in adjust_pool_surplus()
2649 if (h->surplus_huge_pages_node[node]) in adjust_pool_surplus()
2654 if (h->surplus_huge_pages_node[node] < in adjust_pool_surplus()
2655 h->nr_huge_pages_node[node]) in adjust_pool_surplus()
2662 h->surplus_huge_pages += delta; in adjust_pool_surplus()
2663 h->surplus_huge_pages_node[node] += delta; in adjust_pool_surplus()
2667 #define persistent_huge_pages(h) (h->nr_huge_pages - h->surplus_huge_pages)
2675 * Bit mask controlling how hard we retry per-node allocations. in set_max_huge_pages()
2682 return -ENOMEM; in set_max_huge_pages()
2695 count += h->nr_huge_pages - h->nr_huge_pages_node[nid]; in set_max_huge_pages()
2717 return -EINVAL; in set_max_huge_pages()
2733 while (h->surplus_huge_pages && count > persistent_huge_pages(h)) { in set_max_huge_pages()
2734 if (!adjust_pool_surplus(h, nodes_allowed, -1)) in set_max_huge_pages()
2755 /* Bail for signals. Probably ctrl-c from user */ in set_max_huge_pages()
2756 if (signal_pending(current)) in set_max_huge_pages()
2775 min_count = h->resv_huge_pages + h->nr_huge_pages - h->free_huge_pages; in set_max_huge_pages()
2788 h->max_huge_pages = persistent_huge_pages(h); in set_max_huge_pages()
2831 nr_huge_pages = h->nr_huge_pages; in nr_hugepages_show_common()
2833 nr_huge_pages = h->nr_huge_pages_node[nid]; in nr_hugepages_show_common()
2846 return -EINVAL; in __nr_hugepages_store_common()
2904 * hstate attribute for optionally mempolicy-based constraint on persistent
2926 return sprintf(buf, "%lu\n", h->nr_overcommit_huge_pages); in nr_overcommit_hugepages_show()
2937 return -EINVAL; in nr_overcommit_hugepages_store()
2944 h->nr_overcommit_huge_pages = input; in nr_overcommit_hugepages_store()
2960 free_huge_pages = h->free_huge_pages; in free_hugepages_show()
2962 free_huge_pages = h->free_huge_pages_node[nid]; in free_hugepages_show()
2972 return sprintf(buf, "%lu\n", h->resv_huge_pages); in resv_hugepages_show()
2985 surplus_huge_pages = h->surplus_huge_pages; in surplus_hugepages_show()
2987 surplus_huge_pages = h->surplus_huge_pages_node[nid]; in surplus_hugepages_show()
3016 hstate_kobjs[hi] = kobject_create_and_add(h->name, parent); in hugetlb_sysfs_add_hstate()
3018 return -ENOMEM; in hugetlb_sysfs_add_hstate()
3042 pr_err("HugeTLB: Unable to add hstate %s", h->name); in hugetlb_sysfs_init()
3049 * node_hstate/s - associate per node hstate attributes, via their kobjects,
3076 * kobj_to_node_hstate - lookup global hstate for node device hstate attr kobj.
3077 * Returns node id via non-NULL nidp.
3087 if (nhs->hstate_kobjs[i] == kobj) { in kobj_to_node_hstate()
3100 * No-op if no hstate attributes attached.
3105 struct node_hstate *nhs = &node_hstates[node->dev.id]; in hugetlb_unregister_node()
3107 if (!nhs->hugepages_kobj) in hugetlb_unregister_node()
3112 if (nhs->hstate_kobjs[idx]) { in hugetlb_unregister_node()
3113 kobject_put(nhs->hstate_kobjs[idx]); in hugetlb_unregister_node()
3114 nhs->hstate_kobjs[idx] = NULL; in hugetlb_unregister_node()
3118 kobject_put(nhs->hugepages_kobj); in hugetlb_unregister_node()
3119 nhs->hugepages_kobj = NULL; in hugetlb_unregister_node()
3125 * No-op if attributes already registered.
3130 struct node_hstate *nhs = &node_hstates[node->dev.id]; in hugetlb_register_node()
3133 if (nhs->hugepages_kobj) in hugetlb_register_node()
3136 nhs->hugepages_kobj = kobject_create_and_add("hugepages", in hugetlb_register_node()
3137 &node->dev.kobj); in hugetlb_register_node()
3138 if (!nhs->hugepages_kobj) in hugetlb_register_node()
3142 err = hugetlb_sysfs_add_hstate(h, nhs->hugepages_kobj, in hugetlb_register_node()
3143 nhs->hstate_kobjs, in hugetlb_register_node()
3147 h->name, node->dev.id); in hugetlb_register_node()
3156 * devices of nodes that have memory. All on-line nodes should have
3165 if (node->dev.id == nid) in hugetlb_register_all_nodes()
3182 *nidp = -1; in kobj_to_node_hstate()
3196 pr_warn("HugeTLB: huge pages not supported, ignoring associated command-line parameters\n"); in hugetlb_init()
3273 h->order = order; in hugetlb_add_hstate()
3274 h->mask = ~((1ULL << (order + PAGE_SHIFT)) - 1); in hugetlb_add_hstate()
3275 h->nr_huge_pages = 0; in hugetlb_add_hstate()
3276 h->free_huge_pages = 0; in hugetlb_add_hstate()
3278 INIT_LIST_HEAD(&h->hugepage_freelists[i]); in hugetlb_add_hstate()
3279 INIT_LIST_HEAD(&h->hugepage_activelist); in hugetlb_add_hstate()
3280 h->next_nid_to_alloc = first_memory_node; in hugetlb_add_hstate()
3281 h->next_nid_to_free = first_memory_node; in hugetlb_add_hstate()
3282 snprintf(h->name, HSTATE_NAME_LEN, "hugepages-%lukB", in hugetlb_add_hstate()
3315 mhp = &parsed_hstate->max_huge_pages; in hugepages_setup()
3330 if (hugetlb_max_hstate && parsed_hstate->order >= MAX_ORDER) in hugepages_setup()
3384 hugetlb_add_hstate(ilog2(size) - PAGE_SHIFT); in hugepagesz_setup()
3411 hugetlb_add_hstate(ilog2(size) - PAGE_SHIFT); in default_hugepagesz_setup()
3439 unsigned int *array = h->free_huge_pages_node; in allowed_mems_nr()
3475 unsigned long tmp = h->max_huge_pages; in hugetlb_sysctl_handler_common()
3479 return -EOPNOTSUPP; in hugetlb_sysctl_handler_common()
3518 return -EOPNOTSUPP; in hugetlb_overcommit_handler()
3520 tmp = h->nr_overcommit_huge_pages; in hugetlb_overcommit_handler()
3523 return -EINVAL; in hugetlb_overcommit_handler()
3532 h->nr_overcommit_huge_pages = tmp; in hugetlb_overcommit_handler()
3550 unsigned long count = h->nr_huge_pages; in hugetlb_report_meminfo()
3562 h->free_huge_pages, in hugetlb_report_meminfo()
3563 h->resv_huge_pages, in hugetlb_report_meminfo()
3564 h->surplus_huge_pages, in hugetlb_report_meminfo()
3582 nid, h->nr_huge_pages_node[nid], in hugetlb_report_node_meminfo()
3583 nid, h->free_huge_pages_node[nid], in hugetlb_report_node_meminfo()
3584 nid, h->surplus_huge_pages_node[nid]); in hugetlb_report_node_meminfo()
3599 h->nr_huge_pages_node[nid], in hugetlb_show_meminfo()
3600 h->free_huge_pages_node[nid], in hugetlb_show_meminfo()
3601 h->surplus_huge_pages_node[nid], in hugetlb_show_meminfo()
3602 1UL << (huge_page_order(h) + PAGE_SHIFT - 10)); in hugetlb_show_meminfo()
3608 atomic_long_read(&mm->hugetlb_usage) << (PAGE_SHIFT - 10)); in hugetlb_report_usage()
3618 nr_total_pages += h->nr_huge_pages * pages_per_huge_page(h); in hugetlb_total_pages()
3624 int ret = -ENOMEM; in hugetlb_acct_memory()
3632 * current cpuset. Application can still potentially OOM'ed by kernel in hugetlb_acct_memory()
3638 * The change of semantics for shared hugetlb mapping with cpuset is in hugetlb_acct_memory()
3640 * we fall back to check against current free page availability as in hugetlb_acct_memory()
3647 * the memory policy of the current task. Similar to the description in hugetlb_acct_memory()
3662 return_unused_surplus_pages(h, (unsigned long) -delta); in hugetlb_acct_memory()
3683 kref_get(&resv->refs); in hugetlb_vm_op_open()
3698 start = vma_hugecache_offset(h, vma, vma->vm_start); in hugetlb_vm_op_close()
3699 end = vma_hugecache_offset(h, vma, vma->vm_end); in hugetlb_vm_op_close()
3701 reserve = (end - start) - region_count(resv, start, end); in hugetlb_vm_op_close()
3709 hugetlb_acct_memory(h, -gbl_reserve); in hugetlb_vm_op_close()
3712 kref_put(&resv->refs, resv_map_release); in hugetlb_vm_op_close()
3718 return -EINVAL; in hugetlb_vm_op_split()
3731 * handle_mm_fault() to try to instantiate regular-sized pages in the
3763 vma->vm_page_prot))); in make_huge_pte()
3766 vma->vm_page_prot)); in make_huge_pte()
3820 struct address_space *mapping = vma->vm_file->f_mapping; in copy_hugetlb_page_range() local
3824 cow = (vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE; in copy_hugetlb_page_range()
3828 vma->vm_start, in copy_hugetlb_page_range()
3829 vma->vm_end); in copy_hugetlb_page_range()
3838 i_mmap_lock_read(mapping); in copy_hugetlb_page_range()
3841 for (addr = vma->vm_start; addr < vma->vm_end; addr += sz) { in copy_hugetlb_page_range()
3848 ret = -ENOMEM; in copy_hugetlb_page_range()
3917 i_mmap_unlock_read(mapping); in copy_hugetlb_page_range()
3926 struct mm_struct *mm = vma->vm_mm; in __unmap_hugepage_range()
4056 vma->vm_flags &= ~VM_MAYSHARE; in __unmap_hugepage_range_final()
4076 mm = vma->vm_mm; in unmap_hugepage_range()
4094 struct address_space *mapping; in unmap_ref_private() local
4102 pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + in unmap_ref_private()
4103 vma->vm_pgoff; in unmap_ref_private()
4104 mapping = vma->vm_file->f_mapping; in unmap_ref_private()
4107 * Take the mapping lock for the duration of the table walk. As in unmap_ref_private()
4108 * this mapping should be shared between all the VMAs, in unmap_ref_private()
4111 i_mmap_lock_write(mapping); in unmap_ref_private()
4112 vma_interval_tree_foreach(iter_vma, &mapping->i_mmap, pgoff, pgoff) { in unmap_ref_private()
4113 /* Do not unmap the current VMA */ in unmap_ref_private()
4122 if (iter_vma->vm_flags & VM_MAYSHARE) in unmap_ref_private()
4128 * areas. This is because a future no-page fault on this VMA in unmap_ref_private()
4136 i_mmap_unlock_write(mapping); in unmap_ref_private()
4161 /* If no-one else is actually using this page, avoid the copy in hugetlb_cow()
4170 * If the process that created a MAP_PRIVATE mapping is about to in hugetlb_cow()
4174 * consumed or not. If reserves were used, a partial faulted mapping in hugetlb_cow()
4193 * If a process owning a MAP_PRIVATE mapping fails to COW, in hugetlb_cow()
4200 struct address_space *mapping = vma->vm_file->f_mapping; in hugetlb_cow() local
4216 hash = hugetlb_fault_mutex_hash(mapping, idx); in hugetlb_cow()
4218 i_mmap_unlock_read(mapping); in hugetlb_cow()
4222 i_mmap_lock_read(mapping); in hugetlb_cow()
4230 * race occurs while re-acquiring page table in hugetlb_cow()
4293 struct address_space *mapping; in hugetlbfs_pagecache_page() local
4296 mapping = vma->vm_file->f_mapping; in hugetlbfs_pagecache_page()
4299 return find_lock_page(mapping, idx); in hugetlbfs_pagecache_page()
4309 struct address_space *mapping; in hugetlbfs_pagecache_present() local
4313 mapping = vma->vm_file->f_mapping; in hugetlbfs_pagecache_present()
4316 page = find_get_page(mapping, idx); in hugetlbfs_pagecache_present()
4322 int huge_add_to_page_cache(struct page *page, struct address_space *mapping, in huge_add_to_page_cache() argument
4325 struct inode *inode = mapping->host; in huge_add_to_page_cache()
4327 int err = add_to_page_cache(page, mapping, idx, GFP_KERNEL); in huge_add_to_page_cache()
4335 * by non-hugetlbfs specific code paths. in huge_add_to_page_cache()
4339 spin_lock(&inode->i_lock); in huge_add_to_page_cache()
4340 inode->i_blocks += blocks_per_huge_page(h); in huge_add_to_page_cache()
4341 spin_unlock(&inode->i_lock); in huge_add_to_page_cache()
4347 struct address_space *mapping, pgoff_t idx, in hugetlb_no_page() argument
4367 current->pid); in hugetlb_no_page()
4376 size = i_size_read(mapping->host) >> huge_page_shift(h); in hugetlb_no_page()
4381 page = find_lock_page(mapping, idx); in hugetlb_no_page()
4406 hash = hugetlb_fault_mutex_hash(mapping, idx); in hugetlb_no_page()
4408 i_mmap_unlock_read(mapping); in hugetlb_no_page()
4410 i_mmap_lock_read(mapping); in hugetlb_no_page()
4443 if (vma->vm_flags & VM_MAYSHARE) { in hugetlb_no_page()
4444 int err = huge_add_to_page_cache(page, mapping, idx); in hugetlb_no_page()
4447 if (err == -EEXIST) in hugetlb_no_page()
4473 * If we are going to COW a private mapping later, we examine the in hugetlb_no_page()
4478 if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED)) { in hugetlb_no_page()
4497 new_pte = make_huge_pte(vma, page, ((vma->vm_flags & VM_WRITE) in hugetlb_no_page()
4498 && (vma->vm_flags & VM_SHARED))); in hugetlb_no_page()
4502 if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED)) { in hugetlb_no_page()
4531 u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx) in hugetlb_fault_mutex_hash() argument
4536 key[0] = (unsigned long) mapping; in hugetlb_fault_mutex_hash()
4541 return hash & (num_fault_mutexes - 1); in hugetlb_fault_mutex_hash()
4548 u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx) in hugetlb_fault_mutex_hash() argument
4565 struct address_space *mapping; in hugetlb_fault() local
4596 mapping = vma->vm_file->f_mapping; in hugetlb_fault()
4597 i_mmap_lock_read(mapping); in hugetlb_fault()
4600 i_mmap_unlock_read(mapping); in hugetlb_fault()
4610 hash = hugetlb_fault_mutex_hash(mapping, idx); in hugetlb_fault()
4615 ret = hugetlb_no_page(mm, vma, mapping, idx, address, ptep, flags); in hugetlb_fault()
4632 * If we are going to COW the mapping later, we examine the pending in hugetlb_fault()
4647 if (!(vma->vm_flags & VM_MAYSHARE)) in hugetlb_fault()
4697 i_mmap_unlock_read(mapping); in hugetlb_fault()
4701 * the page is not used after unlocked before returning from the current in hugetlb_fault()
4721 struct address_space *mapping; in hugetlb_mcopy_atomic_pte() local
4724 int vm_shared = dst_vma->vm_flags & VM_SHARED; in hugetlb_mcopy_atomic_pte()
4733 * a non-missing case. Return -EEXIST. in hugetlb_mcopy_atomic_pte()
4737 ret = -EEXIST; in hugetlb_mcopy_atomic_pte()
4743 ret = -ENOMEM; in hugetlb_mcopy_atomic_pte()
4753 ret = -ENOENT; in hugetlb_mcopy_atomic_pte()
4770 mapping = dst_vma->vm_file->f_mapping; in hugetlb_mcopy_atomic_pte()
4777 size = i_size_read(mapping->host) >> huge_page_shift(h); in hugetlb_mcopy_atomic_pte()
4778 ret = -EFAULT; in hugetlb_mcopy_atomic_pte()
4788 ret = huge_add_to_page_cache(page, mapping, idx); in hugetlb_mcopy_atomic_pte()
4805 size = i_size_read(mapping->host) >> huge_page_shift(h); in hugetlb_mcopy_atomic_pte()
4806 ret = -EFAULT; in hugetlb_mcopy_atomic_pte()
4810 ret = -EEXIST; in hugetlb_mcopy_atomic_pte()
4821 _dst_pte = make_huge_pte(dst_vma, page, dst_vma->vm_flags & VM_WRITE); in hugetlb_mcopy_atomic_pte()
4822 if (dst_vma->vm_flags & VM_WRITE) in hugetlb_mcopy_atomic_pte()
4829 dst_vma->vm_flags & VM_WRITE); in hugetlb_mcopy_atomic_pte()
4832 /* No need to invalidate - it was non-present before */ in hugetlb_mcopy_atomic_pte()
4860 int err = -EFAULT; in follow_hugetlb_page()
4862 while (vaddr < vma->vm_end && remainder) { in follow_hugetlb_page()
4872 if (fatal_signal_pending(current)) { in follow_hugetlb_page()
4934 * FAULT_FLAG_TRIED can co-exist in follow_hugetlb_page()
4971 (vaddr + huge_page_size(h) < vma->vm_end) && in follow_hugetlb_page()
4974 remainder -= pages_per_huge_page(h); in follow_hugetlb_page()
4996 err = -ENOMEM; in follow_hugetlb_page()
5006 --remainder; in follow_hugetlb_page()
5008 if (vaddr < vma->vm_end && remainder && in follow_hugetlb_page()
5040 struct mm_struct *mm = vma->vm_mm; in hugetlb_change_protection()
5062 i_mmap_lock_write(vma->vm_file->f_mapping); in hugetlb_change_protection()
5123 i_mmap_unlock_write(vma->vm_file->f_mapping); in hugetlb_change_protection()
5126 return pages << h->order; in hugetlb_change_protection()
5134 long ret, chg, add = -1; in hugetlb_reserve_pages()
5144 return -EINVAL; in hugetlb_reserve_pages()
5158 * to reserve the full area even if read-only as mprotect() may be in hugetlb_reserve_pages()
5159 * called to make the mapping read-write. Assume !vma is a shm mapping in hugetlb_reserve_pages()
5161 if (!vma || vma->vm_flags & VM_MAYSHARE) { in hugetlb_reserve_pages()
5172 /* Private mapping. */ in hugetlb_reserve_pages()
5175 return -ENOMEM; in hugetlb_reserve_pages()
5177 chg = to - from; in hugetlb_reserve_pages()
5192 ret = -ENOMEM; in hugetlb_reserve_pages()
5196 if (vma && !(vma->vm_flags & VM_MAYSHARE) && h_cg) { in hugetlb_reserve_pages()
5204 * There must be enough pages in the subpool for the mapping. If in hugetlb_reserve_pages()
5210 ret = -ENOSPC; in hugetlb_reserve_pages()
5228 * the reservation was consumed. Private mappings are per-VMA and in hugetlb_reserve_pages()
5234 if (!vma || vma->vm_flags & VM_MAYSHARE) { in hugetlb_reserve_pages()
5238 hugetlb_acct_memory(h, -gbl_reserve); in hugetlb_reserve_pages()
5253 * reference to h_cg->css. See comment below for detail. in hugetlb_reserve_pages()
5257 (chg - add) * pages_per_huge_page(h), h_cg); in hugetlb_reserve_pages()
5260 chg - add); in hugetlb_reserve_pages()
5261 hugetlb_acct_memory(h, -rsv_adjust); in hugetlb_reserve_pages()
5265 * h_cg->css. So we should release the reference held in hugetlb_reserve_pages()
5280 if (!vma || vma->vm_flags & VM_MAYSHARE) in hugetlb_reserve_pages()
5287 kref_put(&resv_map->refs, resv_map_release); in hugetlb_reserve_pages()
5315 spin_lock(&inode->i_lock); in hugetlb_unreserve_pages()
5316 inode->i_blocks -= (blocks_per_huge_page(h) * freed); in hugetlb_unreserve_pages()
5317 spin_unlock(&inode->i_lock); in hugetlb_unreserve_pages()
5323 gbl_reserve = hugepage_subpool_put_pages(spool, (chg - freed)); in hugetlb_unreserve_pages()
5324 hugetlb_acct_memory(h, -gbl_reserve); in hugetlb_unreserve_pages()
5334 unsigned long saddr = ((idx - svma->vm_pgoff) << PAGE_SHIFT) + in page_table_shareable()
5335 svma->vm_start; in page_table_shareable()
5340 unsigned long vm_flags = vma->vm_flags & VM_LOCKED_CLEAR_MASK; in page_table_shareable()
5341 unsigned long svm_flags = svma->vm_flags & VM_LOCKED_CLEAR_MASK; in page_table_shareable()
5349 sbase < svma->vm_start || svma->vm_end < s_end) in page_table_shareable()
5363 if (vma->vm_flags & VM_MAYSHARE && range_in_vma(vma, base, end)) in vma_shareable()
5376 unsigned long v_start = ALIGN(vma->vm_start, PUD_SIZE), in adjust_range_if_pmd_sharing_possible()
5377 v_end = ALIGN_DOWN(vma->vm_end, PUD_SIZE); in adjust_range_if_pmd_sharing_possible()
5383 if (!(vma->vm_flags & VM_MAYSHARE) || !(v_end > v_start) || in adjust_range_if_pmd_sharing_possible()
5415 struct address_space *mapping = vma->vm_file->f_mapping; in huge_pmd_share() local
5416 pgoff_t idx = ((addr - vma->vm_start) >> PAGE_SHIFT) + in huge_pmd_share()
5417 vma->vm_pgoff; in huge_pmd_share()
5427 i_mmap_assert_locked(mapping); in huge_pmd_share()
5428 vma_interval_tree_foreach(svma, &mapping->i_mmap, idx, idx) { in huge_pmd_share()
5434 spte = huge_pte_offset(svma->vm_mm, saddr, in huge_pmd_share()
5463 * Hugetlb pte page is ref counted at the time of mapping. If pte is shared
5479 i_mmap_assert_write_locked(vma->vm_file->f_mapping); in huge_pmd_unshare()
5487 *addr = ALIGN(*addr, HPAGE_SIZE * PTRS_PER_PTE) - HPAGE_SIZE; in huge_pmd_unshare()
5541 * huge_pte_offset() - Walk the page table to resolve the hugepage
5566 /* must be pud huge, non-present or none */ in huge_pte_offset()
5573 /* must be pmd huge, non-present or none */ in huge_pte_offset()
5587 return ERR_PTR(-EINVAL); in follow_huge_addr()
5602 struct mm_struct *mm = vma->vm_mm; in follow_huge_pmd_pte()
5680 list_move_tail(&page->lru, list); in isolate_huge_page()
5691 list_move_tail(&page->lru, &(page_hstate(page))->hugepage_activelist); in putback_active_hugepage()
5709 * Also note that we have to transfer the per-node surplus state in move_hugetlb_state()
5711 * the per-node's. in move_hugetlb_state()
5721 if (h->surplus_huge_pages_node[old_nid]) { in move_hugetlb_state()
5722 h->surplus_huge_pages_node[old_nid]--; in move_hugetlb_state()
5723 h->surplus_huge_pages_node[new_nid]++; in move_hugetlb_state()
5769 size = min(per_node, hugetlb_cma_size - reserved); in hugetlb_cma_reserve()
5796 pr_warn("hugetlb_cma: the option isn't supported by current arch\n"); in hugetlb_cma_check()