函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:vb_alloc

函数原型:static void *vb_alloc(unsigned long size, gfp_t gfp_mask)

返回类型:void

参数:

类型参数名称
unsigned longsize
gfp_tgfp_mask
1610  void * vaddr = NULL
1613  BUG_ON(offset_in_page(size))
1614  BUG_ON(size > PAGE_SIZE * 256K with 4K pages )
1615  如果WARN_ON(size == 0)则
1621  返回:NULL
1623  order等于get_order - Determine the allocation order of a memory size*@size: The size for which to get the order* Determine the allocation order of a particular sized block of memory
1625  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
1626  vbq等于Must be an lvalue. Since @var must be a simple identifier,* we force a syntax error here if it isn't.(Queue of free and dirty vmap blocks, for allocation and flushing purposes )
1630  加自旋锁
1631  如果free小于1UL左移order位则
1632  自旋锁解锁
1633  继续下一循环
1636  pages_off等于VMAP_BBMAP_BITSfree
1637  vaddr等于vmap_block_vaddr(va_start, pages_off)
1638  free减等于1UL左移order
1639  如果free恒等于0则
1640  加自旋锁
1641  删除不需要重新初始化的列表项
1642  自旋锁解锁
1645  自旋锁解锁
1646  退出
1649  The weird & is necessary because sparse considers (void)(var) to be* a direct dereference of percpu variable (var).(Queue of free and dirty vmap blocks, for allocation and flushing purposes )
1650  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1653  如果非vaddrvaddr等于w_vmap_block - allocates new vmap_block and occupies 2^order pages in this* block
1656  返回:vaddr
调用者
名称描述
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