Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:unmapped_area

Proto:unsigned long unmapped_area(struct vm_unmapped_area_info *info)

Type:unsigned long

Parameter:

TypeParameterName
struct vm_unmapped_area_info *info
1865  mm = mm
1870  length = length + align_mask
1871  If length < length Then Return -ENOMEM
1875  If high_limit < length Then Return -ENOMEM
1877  high_limit = high_limit - length
1879  If low_limit > high_limit Then Return -ENOMEM
1881  low_limit = low_limit + length
1884  If RB_EMPTY_ROOT( & mm_rb) Then Go to check_highest
1886  vma = rb_entry(rb_node, structvm_area_struct, vm_rb)
1887  If Largest free memory gap in bytes to the left of this VMA.* Either between this VMA and vma->vm_prev, or between one of the* VMAs below us in the VMA rbtree and its ->vm_prev. This helps* get_unmapped_area find a free area of the right size. < length Then Go to check_highest
1890  When (true) cycle
1892  gap_end = vm_start_gap(vma)
1893  If gap_end >= low_limit && rb_left Then
1898  vma = left
1899  Continue
1903  gap_start = If linked list of VM areas per task, sorted by address Then vm_end_gap(linked list of VM areas per task, sorted by address ) Else 0
1904  check_current :
1906  If gap_start > high_limit Then Return -ENOMEM
1908  If gap_end >= low_limit && gap_end > gap_start && gap_end - gap_start >= length Then Go to found
1913  If rb_right Then
1918  vma = right
1919  Continue
1924  When (true) cycle
1925  prev = vm_rb
1926  If Not rb_parent(prev) Then Go to check_highest
1930  If prev == rb_left Then
1938  check_highest :
1940  gap_start = highest vma end address
1941  gap_end = ULONG_MAX
1942  If gap_start > high_limit Then Return -ENOMEM
1945  found :
1947  If gap_start < low_limit Then gap_start = low_limit
1951  gap_start += align_offset - gap_start & align_mask
1953  VM_BUG_ON(gap_start + length > high_limit)
1954  VM_BUG_ON(gap_start + length > gap_end)
1955  Return gap_start
Caller
NameDescribe
vm_unmapped_areaSearch for an unmapped address range