Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:hugetlb_reserve_pages

Proto:int hugetlb_reserve_pages(struct inode *inode, long from, long to, struct vm_area_struct *vma, vm_flags_t vm_flags)

Type:int

Parameter:

TypeParameterName
struct inode *inode
longfrom
longto
struct vm_area_struct *vma
vm_flags_tvm_flags
4545  h = hstate_inode(inode)
4546  spool = subpool_inode(inode)
4551  If from > to Then
4552  VM_WARN(1, "%s called with a negative range\n", __func__)
4553  Return -EINVAL
4561  If vm_flags & should the VM suppress accounting Then Return 0
4570  If Not vma || Flags, see mm.h. & VM_MAYSHARE Then
4576  resv_map = inode_resv_map(inode)
4578  chg = Examine the existing reserve map and determine how many* huge pages in the specified range [f, t) are NOT currently* represented. This routine is called before a subsequent* call to region_add that will actually modify the reserve
4580  Else
4581  resv_map = resv_map_alloc()
4582  If Not resv_map Then Return -ENOMEM
4585  chg = to - from
4587  set_vma_resv_map(vma, resv_map)
4588  set_vma_resv_flags(vma, Flags for MAP_PRIVATE reservations. These are stored in the bottom* bits of the reservation map pointer, which are always clear due to* alignment.)
4591  If chg < 0 Then
4592  ret = chg
4593  Go to out_err
4601  gbl_reserve = Subpool accounting for allocating and reserving pages
4602  If gbl_reserve < 0 Then
4603  ret = -ENOSPC
4604  Go to out_err
4611  ret = Forward declaration
4612  If ret < 0 Then
4614  Subpool accounting for freeing and unreserving pages.* Return the number of global page reservations that must be dropped.* The return value may only be different than the passed value (delta)* in the case where a subpool minimum size must be maintained.
4615  Go to out_err
4629  If Not vma || Flags, see mm.h. & VM_MAYSHARE Then
4630  add = Add the huge page range represented by [f, t) to the reserve* map
4647  Return 0
4648  out_err :
4649  If Not vma || Flags, see mm.h. & VM_MAYSHARE Then If chg >= 0 Then
4652  Abort the in progress add operation. The adds_in_progress field* of the resv_map keeps track of the operations in progress between* calls to region_chg and region_add. Operations are sometimes* aborted after the call to region_chg
4653  If vma && is_vma_resv_set(vma, Flags for MAP_PRIVATE reservations. These are stored in the bottom* bits of the reservation map pointer, which are always clear due to* alignment.) Then kref_put - decrement refcount for object.*@kref: object.*@release: pointer to the function that will clean up the object when the* last reference to the object is released.* This pointer is required, and it is not acceptable to pass kfree
4655  Return ret