函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\slob.c Create Date:2022-07-27 17:09:35
Last Modify:2022-05-20 09:26:42 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:slob_free: entry point into the slob allocator.

函数原型:static void slob_free(void *block, int size)

返回类型:void

参数:

类型参数名称
void *block
intsize
385  b等于block
390  如果此条件成立可能性小(为编译器优化)(ZERO_OR_NULL_PTR(block))则返回
392  BUG_ON(!size)
394  sp等于virt_to_page(kaddr) returns a valid pointer if and only if* virt_addr_valid(kaddr) returns true.(block)
395  units等于SLOB_UNITS(size)
397  spin_lock_irqsave( & slob_lock protects all slob allocator structures., flags)
399  如果 SLOB units恒等于SLOB_UNITS(PAGE_SIZE)则
401  如果slob_page_free: true for pages on free_slob_pages list.clear_slob_page_free(sp)
403  spin_unlock_irqrestore( & slob_lock protects all slob allocator structures., flags)
404  __ClearPageSlab(sp)
405  The atomic page->_mapcount, starts from -1: so that transitions* both from it and to it can be tracked, using atomic_inc_and_test* and atomic_add_negative(-1).
406  slob_free_pages(b, 0)
407  返回
410  如果非slob_page_free: true for pages on free_slob_pages list.
412  SLOB 等于units
413  first free object 等于b
414  Encode the given size and next info into a free slob block s.
417  如果size小于All partially free slob pages go on these lists.slob_list等于free_slob_small
419  否则如果size小于SLOB_BREAK2slob_list等于free_slob_medium
421  否则slob_list等于free_slob_large
423  set_slob_page_free(sp, slob_list)
424  转到:out
431  SLOB 加等于units
433  如果b小于 first free object
434  如果bunits恒等于 first free object
438  Encode the given size and next info into a free slob block s.
439  first free object 等于b
440  否则
441  prev等于 first free object
442  next等于Return the next free slob block pointer after this one.
443 b大于next循环
444  prev等于next
451  否则Encode the given size and next info into a free slob block s.
454  如果prevReturn the size of a slob block.恒等于b
457  否则Encode the given size and next info into a free slob block s.
460  out :
461  spin_unlock_irqrestore( & slob_lock protects all slob allocator structures., flags)
调用者
名称描述
kfree释放内存
__kmem_cache_free