Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\hugetlb.c Create Date:2022-07-28 15:26:40
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Increase the hugetlb pool such that it can accommodate a reservation* of size 'delta'.

Proto:static int gather_surplus_pages(struct hstate *h, int delta)

Type:int

Parameter:

TypeParameterName
struct hstate *h
intdelta
1703  bool alloc_ok = true
1705  needed = resv_huge_pages + delta - free_huge_pages
1706  If needed <= 0 Then
1707  resv_huge_pages += delta
1708  Return 0
1711  allocated = 0
1712  Initialization list head
1714  ret = -ENOMEM
1715  retry :
1716  spin_unlock( & Protects updates to hugepage_freelists, hugepage_activelist, nr_huge_pages,* free_huge_pages, and surplus_huge_pages.)
1717  When i < needed cycle
1718  page = Allocates a fresh surplus page from the page allocator.
1720  If Not page Then
1721  alloc_ok = false
1722  Break
1724  list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
1725  cond_resched()
1727  allocated += i
1733  spin_lock( & Protects updates to hugepage_freelists, hugepage_activelist, nr_huge_pages,* free_huge_pages, and surplus_huge_pages.)
1734  needed = resv_huge_pages + delta - free_huge_pages + allocated
1736  If needed > 0 Then
1737  If alloc_ok Then Go to retry
1744  Go to free
1754  needed += allocated
1755  resv_huge_pages += delta
1756  ret = 0
1760  If --needed < 0 Then Break
1766  Drop a ref, return true if the refcount fell to zero (the page has no users)
1767  VM_BUG_ON_PAGE(page_count(page), page)
1768  enqueue_huge_page(h, page)
1770  free :
1771  spin_unlock( & Protects updates to hugepage_freelists, hugepage_activelist, nr_huge_pages,* free_huge_pages, and surplus_huge_pages.)
1774  list_for_each_entry_safe - iterate over list of given type safe against removal of list entry*@pos: the type * to use as a loop cursor.*@n: another type * to use as temporary storage*@head: the head for your list.(page, tmp, & surplus_list, lru)
1775  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
1776  spin_lock( & Protects updates to hugepage_freelists, hugepage_activelist, nr_huge_pages,* free_huge_pages, and surplus_huge_pages.)
1778  Return ret
Caller
NameDescribe
hugetlb_acct_memoryForward declaration