Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:adjust_va_to_fit_type

Proto:static __always_inline int adjust_va_to_fit_type(struct vmap_area *va, unsigned long nva_start_addr, unsigned long size, enum fit_type type)

Type:int

Parameter:

TypeParameterName
struct vmap_area *va
unsigned longnva_start_addr
unsigned longsize
enum fit_typetype
926  struct vmap_area * lva = NULL
928  If type == full fit Then
936  unlink_va(va, & This augment red-black tree represents the free vmap space)
937  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)
938  Else if type == left edge fit Then
946  va_start += size
947  Else if type == right edge fit Then
955  va_end = nva_start_addr
956  Else if type == NE_FIT_TYPE Then
964  lva = __this_cpu_xchg(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)
992  If Not lva Then Return -1
999  va_start = va_start
1000  va_end = nva_start_addr
1005  va_start = nva_start_addr + size
1006  Else
1007  Return -1
1010  If type != full fit Then
1011  This function populates subtree_max_size from bottom to upper* levels starting from VA point
1013  If lva Then insert_vmap_area_augment(lva, & address sorted rbtree , & This augment red-black tree represents the free vmap space, & This linked list is used in pair with free_vmap_area_root.* It gives O(1) access to prev/next to perform fast coalescing.)
1018  Return 0
Caller
NameDescribe
__alloc_vmap_areaReturns a start address of the newly allocated area, if success.* Otherwise a vend is returned that indicates failure.