函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:unmapped_area_topdown

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

返回类型:unsigned long

参数:

类型参数名称
struct vm_unmapped_area_info *info
1960  mm等于mm
1965  length等于lengthalign_mask
1966  如果length小于length则返回:负ENOMEM
1973  gap_end等于high_limit
1974  如果gap_end小于length则返回:负ENOMEM
1976  high_limit等于gap_endlength
1978  如果low_limit大于high_limit则返回:负ENOMEM
1980  low_limit等于low_limitlength
1983  gap_start等于 highest vma end address
1984  如果gap_start小于等于high_limit则转到:found_highest
1988  如果RB_EMPTY_ROOT( & mm_rb)则返回:负ENOMEM
1990  vma等于rb_entry(rb_node, structvm_area_struct, vm_rb)
1991  如果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则返回:负ENOMEM
1994  当(true)循环
1996  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
1997  如果gap_start小于等于high_limitrb_right
1998  right等于rb_entry(rb_right, structvm_area_struct, vm_rb)
2002  vma等于right
2003  继续下一循环
2007  check_current :
2009  gap_end等于vm_start_gap(vma)
2010  如果gap_end小于low_limit则返回:负ENOMEM
2012  如果gap_start小于等于high_limitgap_end大于gap_startgap_endgap_start大于等于length则转到:found
2017  如果rb_left
2018  left等于rb_entry(rb_left, structvm_area_struct, vm_rb)
2022  vma等于left
2023  继续下一循环
2028  当(true)循环
2029  prev等于vm_rb
2030  如果非rb_parent(prev)则返回:负ENOMEM
2032  vma等于rb_entry(rb_parent(prev), structvm_area_struct, vm_rb)
2034  如果prev恒等于rb_right
2042  found :
2044  如果gap_end大于high_limitgap_end等于high_limit
2047  found_highest :
2049  gap_end减等于length
2050  gap_end减等于gap_endalign_offset按位与align_mask
2052  VM_BUG_ON(gap_end < low_limit)
2053  VM_BUG_ON(gap_end < gap_start)
2054  返回:gap_end
调用者
名称描述
vm_unmapped_areaSearch for an unmapped address range