函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:gen_pool_alloc_algo_owner - allocate special memory from the pool*@pool: pool to allocate from*@size: number of bytes to allocate from the pool*@algo: algorithm passed from caller*@data: data passed to algorithm*@owner: optionally retrieve the chunk owner

函数原型:unsigned long gen_pool_alloc_algo_owner(struct gen_pool *pool, size_t size, genpool_algo_t algo, void *data, void **owner)

返回类型:unsigned long

参数:

类型参数名称
struct gen_pool *pool
size_tsize
genpool_algo_talgo
void *data
void **owner
279  addr等于0
280  order等于 minimum allocation order
284  BUG_ON(in_nmi())
287  如果owner则 * owner = NULL
290  如果size恒等于0则返回:0
293  nbits等于size加1UL左移order位的值减1右移order
294  _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
296  如果size大于atomic_long_read( & avail)则继续下一循环
299  start_bit等于0
300  end_bit等于chunk_size(chunk)右移order
301  retry :
302  start_bit等于algo(map for allocating memory chunk , end_bit, start_bit, nbits, data, pool, start address of memory chunk )
304  如果start_bit大于等于end_bit则继续下一循环
306  remain等于map_set_ll - set the specified number of bits at the specified position*@map: pointer to a bitmap*@start: a bit position in @map*@nr: number of bits to set* Set @nr bits start from @start in @map lock-lessly. Several users
307  如果remain
308  remain等于map_clear_ll - clear the specified number of bits at the specified position*@map: pointer to a bitmap*@start: a bit position in @map*@nr: number of bits to set* Clear @nr bits start from @start in @map lock-lessly. Several users
310  BUG_ON(remain)
311  转到:retry
314  addr等于start address of memory chunk start_bit左移order位的值
315  size等于nbits左移order
316  atomic_long_sub(size, & avail)
317  如果ownerowner等于private data to retrieve at alloc time
319  退出
321  _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()
322  返回:addr
调用者
名称描述
gen_pool_alloc_owner
gen_pool_alloc_algo