Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name: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

Proto:unsigned long gen_pool_alloc_algo_owner(struct gen_pool *pool, size_t size, genpool_algo_t algo, void *data, void **owner)

Type:unsigned long

Parameter:

TypeParameterName
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  If owner Then * owner = NULL
290  If size == 0 Then Return 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  If size > atomic_long_read( & avail) Then Continue
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  If start_bit >= end_bit Then Continue
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  If remain Then
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  Go to retry
314  addr = start address of memory chunk + (start_bit << order)
315  size = nbits << order
316  atomic_long_sub(size, & avail)
317  If owner Then owner = private data to retrieve at alloc time
319  Break
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  Return addr
Caller
NameDescribe
gen_pool_alloc_owner
gen_pool_alloc_algo