Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Allocates a fresh surplus page from the page allocator.

Proto:static struct page *alloc_surplus_huge_page(struct hstate *h, gfp_t gfp_mask, int nid, nodemask_t *nmask)

Type:struct page

Parameter:

TypeParameterName
struct hstate *h
gfp_tgfp_mask
intnid
nodemask_t *nmask
1555  struct page * page = NULL
1557  If hstate_is_gigantic(h) Then Return NULL
1560  spin_lock( & Protects updates to hugepage_freelists, hugepage_activelist, nr_huge_pages,* free_huge_pages, and surplus_huge_pages.)
1561  If surplus_huge_pages >= nr_overcommit_huge_pages Then Go to out_unlock
1563  spin_unlock( & Protects updates to hugepage_freelists, hugepage_activelist, nr_huge_pages,* free_huge_pages, and surplus_huge_pages.)
1565  page = Common helper to allocate a fresh hugetlb page. All specific allocators* should use this function to get new hugetlb pages
1566  If Not page Then Return NULL
1569  spin_lock( & Protects updates to hugepage_freelists, hugepage_activelist, nr_huge_pages,* free_huge_pages, and surplus_huge_pages.)
1577  If surplus_huge_pages >= nr_overcommit_huge_pages Then
1578  SetPageHugeTemporary(page)
1579  spin_unlock( & Protects updates to hugepage_freelists, hugepage_activelist, nr_huge_pages,* free_huge_pages, and surplus_huge_pages.)
1580  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
1581  Return NULL
1582  Else
1583  surplus_huge_pages++
1584  surplus_huge_pages_node[page_to_nid(page)]++
1587  out_unlock :
1588  spin_unlock( & Protects updates to hugepage_freelists, hugepage_activelist, nr_huge_pages,* free_huge_pages, and surplus_huge_pages.)
1590  Return page
Caller
NameDescribe
alloc_buddy_huge_page_with_mpolUse the VMA's mpolicy to allocate a huge page from the buddy.
gather_surplus_pagesIncrease the hugetlb pool such that it can accommodate a reservation* of size 'delta'.