函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\hugetlb.c Create Date:2022-07-27 16:57:59
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Increase the hugetlb pool such that it can accommodate a reservation* of size 'delta'.

函数原型:static int gather_surplus_pages(struct hstate *h, int delta)

返回类型:int

参数:

类型参数名称
struct hstate *h
intdelta
1703  bool alloc_ok = true
1705  needed等于resv_huge_pagesdeltafree_huge_pages
1706  如果needed小于等于0则
1707  resv_huge_pages加等于delta
1708  返回:0
1711  allocated等于0
1712  初始化链表头
1714  ret等于负ENOMEM
1715  retry :
1716  自旋锁解锁
1717 i小于needed循环
1718  page等于Allocates a fresh surplus page from the page allocator.
1720  如果非page
1721  alloc_ok = false
1722  退出
1724  添加链表项
1725  cond_resched()
1727  allocated加等于i
1733  加自旋锁
1734  needed等于resv_huge_pagesdeltafree_huge_pagesallocated
1736  如果needed大于0则
1737  如果alloc_ok则转到:retry
1744  转到:free
1754  needed加等于allocated
1755  resv_huge_pages加等于delta
1756  ret等于0
1760  如果needed先自减小于0则退出
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  自旋锁解锁
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  加自旋锁
1778  返回:ret
调用者
名称描述
hugetlb_acct_memoryForward declaration