函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:mempool_resize - resize an existing memory pool*@pool: pointer to the memory pool which was allocated via* mempool_create().*@new_min_nr: the new minimum number of elements guaranteed to be* allocated for this pool.* This function shrinks/grows the pool

函数原型:int mempool_resize(mempool_t *pool, int new_min_nr)

返回类型:int

参数:

类型参数名称
mempool_t *pool
intnew_min_nr
305  BUG_ON(new_min_nr <= 0)
306  might_sleep()
308  spin_lock_irqsave( & lock, flags)
309  如果new_min_nr小于等于 nr of elements at *elements
316  nr of elements at *elements 等于new_min_nr
317  转到:out_unlock
319  spin_unlock_irqrestore( & lock, flags)
322  new_elements等于分配数组内存
324  如果非new_elements则返回:负ENOMEM
327  spin_lock_irqsave( & lock, flags)
328  如果此条件成立可能性小(为编译器优化)(new_min_nr <= nr of elements at *elements )则
330  spin_unlock_irqrestore( & lock, flags)
331  释放内存
332  转到:out
334  memcpy(new_elements, elements, Current nr of elements at *elements * new_elements的长度)
336  释放内存
337  elements等于new_elements
338  nr of elements at *elements 等于new_min_nr
340  Current nr of elements at *elements 小于 nr of elements at *elements 循环
341  spin_unlock_irqrestore( & lock, flags)
342  element等于alloc(GFP_KERNEL, pool_data)
343  如果非element则转到:out
345  spin_lock_irqsave( & lock, flags)
348  否则
351  转到:out
354  out_unlock :
355  spin_unlock_irqrestore( & lock, flags)
356  out :
357  返回:0