函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:unmapped_area

函数原型:unsigned long unmapped_area(struct vm_unmapped_area_info *info)

返回类型:unsigned long

参数:

类型参数名称
struct vm_unmapped_area_info *info
1865  mm等于mm
1870  length等于lengthalign_mask
1871  如果length小于length则返回:负ENOMEM
1875  如果high_limit小于length则返回:负ENOMEM
1877  high_limit等于high_limitlength
1879  如果low_limit大于high_limit则返回:负ENOMEM
1881  low_limit等于low_limitlength
1884  如果RB_EMPTY_ROOT( & mm_rb)则转到:check_highest
1886  vma等于rb_entry(rb_node, structvm_area_struct, vm_rb)
1887  如果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则转到:check_highest
1890  当(true)循环
1892  gap_end等于vm_start_gap(vma)
1893  如果gap_end大于等于low_limitrb_left
1894  left等于rb_entry(rb_left, structvm_area_struct, vm_rb)
1898  vma等于left
1899  继续下一循环
1903  gap_start等于如果linked list of VM areas per task, sorted by address vm_end_gap(linked list of VM areas per task, sorted by address )否则0
1904  check_current :
1906  如果gap_start大于high_limit则返回:负ENOMEM
1908  如果gap_end大于等于low_limitgap_end大于gap_startgap_endgap_start大于等于length则转到:found
1913  如果rb_right
1914  right等于rb_entry(rb_right, structvm_area_struct, vm_rb)
1918  vma等于right
1919  继续下一循环
1924  当(true)循环
1925  prev等于vm_rb
1926  如果非rb_parent(prev)则转到:check_highest
1928  vma等于rb_entry(rb_parent(prev), structvm_area_struct, vm_rb)
1930  如果prev恒等于rb_left
1938  check_highest :
1940  gap_start等于 highest vma end address
1941  gap_end等于ULONG_MAX
1942  如果gap_start大于high_limit则返回:负ENOMEM
1945  found :
1947  如果gap_start小于low_limitgap_start等于low_limit
1951  gap_start加等于align_offsetgap_start按位与align_mask
1953  VM_BUG_ON(gap_start + length > high_limit)
1954  VM_BUG_ON(gap_start + length > gap_end)
1955  返回:gap_start
调用者
名称描述
vm_unmapped_areaSearch for an unmapped address range