Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\slob.c Create Date:2022-07-28 15:36:11
Last Modify:2022-05-20 09:26:42 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:slob_free: entry point into the slob allocator.

Proto:static void slob_free(void *block, int size)

Type:void

Parameter:

TypeParameterName
void *block
intsize
385  b = block
390  If Value for the false possibility is greater at compile time(ZERO_OR_NULL_PTR(block)) Then Return
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  If SLOB + units == SLOB_UNITS(PAGE_SIZE) Then
401  If slob_page_free: true for pages on free_slob_pages list. Then 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  Return
410  If Not slob_page_free: true for pages on free_slob_pages list. Then
412  SLOB = units
413  first free object = b
414  Encode the given size and next info into a free slob block s.
417  If size < All partially free slob pages go on these lists. Then slob_list = free_slob_small
419  Else if size < SLOB_BREAK2 Then slob_list = free_slob_medium
421  Else slob_list = free_slob_large
423  set_slob_page_free(sp, slob_list)
424  Go to out
431  SLOB += units
433  If b < first free object Then
434  If b + units == first free object Then
438  Encode the given size and next info into a free slob block s.
439  first free object = b
440  Else
441  prev = first free object
442  next = Return the next free slob block pointer after this one.
443  When b > next cycle
444  prev = next
451  Else Encode the given size and next info into a free slob block s.
457  Else 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)
Caller
NameDescribe
kfree
__kmem_cache_free