函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

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

函数原型:static void *slob_alloc(size_t size, gfp_t gfp, int align, int node, int align_offset)

返回类型:void

参数:

类型参数名称
size_tsize
gfp_tgfp
intalign
intnode
intalign_offset
306  slob_t * b = NULL
310  如果size小于All partially free slob pages go on these lists.slob_list等于free_slob_small
312  否则如果size小于SLOB_BREAK2slob_list等于free_slob_medium
314  否则slob_list等于free_slob_large
317  spin_lock_irqsave( & slob_lock protects all slob allocator structures., flags)
320  bool page_removed_from_list = false
326  如果node不等于NUMA_NO_NODEpage_to_nid(sp)不等于node则继续下一循环
330  如果 SLOB 小于SLOB_UNITS(size)则继续下一循环
333  b等于slob_page_alloc() - Allocate a slob block within a given slob_page sp.*@sp: Page to look in.*@size: Size of the allocation.*@align: Allocation alignment.*@align_offset: Offset in the allocated block that will be aligned.
334  如果非b则继续下一循环
343  如果非page_removed_from_list
349  如果非list_is_first -- tests whether @list is the first entry in list @head*@list: the entry to test*@head: the head of the listlist_rotate_to_front() - Rotate list to specific item.*@list: The desired new front of the list.*@head: The head of the list.* Rotates list so that @list becomes the new front of the list.
352  退出
354  spin_unlock_irqrestore( & slob_lock protects all slob allocator structures., flags)
357  如果非b
358  b等于slob_new_pages(gfp & ~__GFP_ZERO, 0, node)
359  如果非b则返回:NULL
361  sp等于virt_to_page(kaddr) returns a valid pointer if and only if* virt_addr_valid(kaddr) returns true.(b)
362  __SetPageSlab(sp)
364  spin_lock_irqsave( & slob_lock protects all slob allocator structures., flags)
365  SLOB 等于SLOB_UNITS(PAGE_SIZE)
366  first free object 等于b
367  初始化链表头
368  Encode the given size and next info into a free slob block s.
369  set_slob_page_free(sp, slob_list)
370  b等于slob_page_alloc() - Allocate a slob block within a given slob_page sp.*@sp: Page to look in.*@size: Size of the allocation.*@align: Allocation alignment.*@align_offset: Offset in the allocated block that will be aligned.
371  BUG_ON(!b)
372  spin_unlock_irqrestore( & slob_lock protects all slob allocator structures., flags)
374  如果此条件成立可能性小(为编译器优化)(gfp & __GFP_ZERO)则memset(b, 0, size)
376  返回:b
调用者
名称描述
__do_kmalloc_nodeEnd of slob allocator proper. Begin kmem_cache_alloc and kmalloc frontend.
slob_alloc_node