函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Allocate a region of KVA of the specified size and alignment, within the* vstart and vend.

函数原型:static struct vmap_area *alloc_vmap_area(unsigned long size, unsigned long align, unsigned long vstart, unsigned long vend, int node, gfp_t gfp_mask)

返回类型:struct vmap_area

参数:

类型参数名称
unsigned longsize
unsigned longalign
unsigned longvstart
unsigned longvend
intnode
gfp_tgfp_mask
1095  purged等于0
1098  BUG_ON(!size)
1099  BUG_ON(offset_in_page(size))
1100  BUG_ON(!s_power_of_2() - check if a value is a power of two*@n: the value to check* Determine whether some value is a power of two, where zero is* *not* considered a power of two.* Return: true if @n is a power of 2, otherwise false.)
1102  如果此条件成立可能性小(为编译器优化)(!vmap_initialized)则返回:错误号
1105  might_sleep()
1106  gfp_mask等于gfp_mask按位与The set of flags that only affect watermark checking and reclaim* behaviour. This is used by the MM to obey the caller constraints* about IO, FS and watermark checking while ignoring placement* hints such as HIGHMEM usage.
1108  va等于在指定节点上分配一个对象
1109  如果此条件成立可能性小(为编译器优化)(!va)则返回:错误号
1116  kmemleak_scan_area( & address sorted rbtree , SIZE_MAX, gfp_mask)
1118  retry :
1134  pva = NULL
1136  如果非Operations with implied preemption/interrupt protection. These* operations can be used without worrying about preemption or interrupt.(Preload a CPU with one object for "no edge" split case. The* aim is to get rid of allocations from the atomic context, thus* to use more permissive allocation masks.)则pva等于在指定节点上分配一个对象
1144  加自旋锁
1146  如果pva__this_cpu_cmpxchg(Preload a CPU with one object for "no edge" split case. The* aim is to get rid of allocations from the atomic context, thus* to use more permissive allocation masks., NULL, pva)则kmem_cache_free(This kmem_cache is used for vmap_area objects. Instead of* allocating from slab we reuse an object from this cache to* make things faster. Especially in "no edge" splitting of* free block., pva)
1153  addr等于Returns a start address of the newly allocated area, if success.* Otherwise a vend is returned that indicates failure.
1154  自旋锁解锁
1156  如果此条件成立可能性小(为编译器优化)(addr == vend)则转到:overflow
1159  va_start等于addr
1160  va_end等于addrsize
1161  in "busy" tree = NULL
1164  加自旋锁
1165  insert_vmap_area(va, & vmap_area_root, & Export for kexec only )
1166  自旋锁解锁
1168  BUG_ON(!IS_ALIGNED(va_start, align))
1169  BUG_ON(va_start < vstart)
1170  BUG_ON(va_end > vend)
1172  ret等于kasan_populate_vmalloc(addr, size)
1173  如果ret
1174  Free a region of KVA allocated by alloc_vmap_area
1175  返回:错误号
1178  返回:va
1180  overflow :
1181  如果非purged
1182  purge_vmap_area_lazy()
1183  purged等于1
1184  转到:retry
1187  如果gfpflags_allow_blocking(gfp_mask)则
1188  freed等于0
1189  blocking_notifier_call_chain( & vmap_notify_list, 0, & freed)
1190  如果freed大于0则
1191  purged等于0
1192  转到:retry
1196  如果非gfp_mask按位与DOC: Action modifiers* Action modifiers* ~~~~~~~~~~~~~~~~* %__GFP_NOWARN suppresses allocation failure reports.* %__GFP_COMP address compound page metadata.* %__GFP_ZERO returns a zeroed page on success.的值且printk_ratelimit()则打印警告信息("vmap allocation for size %lu failed: use vmalloc=<size> to increase size\n", size)
1200  kmem_cache_free(This kmem_cache is used for vmap_area objects. Instead of* allocating from slab we reuse an object from this cache to* make things faster. Especially in "no edge" splitting of* free block., va)
1201  返回:错误号
调用者
名称描述
new_vmap_blockw_vmap_block - allocates new vmap_block and occupies 2^order pages in this* block
vm_map_ramvm_map_ram - map pages linearly into kernel virtual address (vmalloc space)*@pages: an array of pointers to the pages to be mapped*@count: number of pages*@node: prefer to allocate data structures on this node*@prot: memory protection to use
__get_vm_area_node