函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Slow path. The lockless freelist is empty or we need to perform* debugging duties.* Processing is still very fast if new objects have been freed to the* regular freelist. In that case we simply take over the regular freelist

函数原型:static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, unsigned long addr, struct kmem_cache_cpu *c)

返回类型:void

参数:

类型参数名称
struct kmem_cache *s
gfp_tgfpflags
intnode
unsigned longaddr
struct kmem_cache_cpu *c
2546  page等于 The slab from which we are allocating
2547  如果非page则转到:new_slab
2549  redo :
2551  如果此条件成立可能性小(为编译器优化)(!Check if the objects in a per cpu structure fit numa* locality expectations.)则
2552  searchnode等于node
2554  如果node不等于NUMA_NO_NODE且非node_present_pages(node)则searchnode等于node_to_mem_node(node)
2560  转到:new_slab
2569  如果此条件成立可能性小(为编译器优化)(!pfmemalloc_match(page, gfpflags))则
2570  Remove the cpu slab
2571  转到:new_slab
2575  freelist等于 Pointer to next available object
2576  如果freelist则转到:load_freelist
2579  freelist等于Check the page->freelist of a page and either transfer the freelist to the* per cpu freelist or deactivate the page.* The page is still frozen if the return value is not NULL.* If this function returns NULL then the page has been unfrozen.
2581  如果非freelist
2582  The slab from which we are allocating = NULL
2583  stat(s, Implicit deactivation )
2584  转到:new_slab
2587  stat(s, Refill cpu slab from slab freelist )
2589  load_freelist :
2595  VM_BUG_ON(!frozen)
2596  Pointer to next available object 等于get_freepointer(s, freelist)
2597  Globally unique transaction id 等于next_tid( Globally unique transaction id )
2598  返回:freelist
2600  new_slab :
2602  如果slub_percpu_partial(c)则
2603  page等于 The slab from which we are allocating 等于slub_percpu_partial(c)
2605  stat(s, Used cpu partial on alloc )
2606  转到:redo
2609  freelist等于new_slab_objects(s, gfpflags, node, & c)
2611  如果此条件成立可能性小(为编译器优化)(!freelist)则
2612  slab_out_of_memory(s, gfpflags, node)
2613  返回:NULL
2616  page等于 The slab from which we are allocating
2617  如果此条件成立可能性大(为编译器优化)(!Lock order:* 1. slab_mutex (Global Mutex)* 2. node->list_lock* 3. slab_lock(page) (Only on some arches and for debugging)* slab_mutex* The role of the slab_mutex is to protect the list of all the slabs && pfmemalloc_match(page, gfpflags))则转到:load_freelist
2621  如果Lock order:* 1. slab_mutex (Global Mutex)* 2. node->list_lock* 3. slab_lock(page) (Only on some arches and for debugging)* slab_mutex* The role of the slab_mutex is to protect the list of all the slabs且非alloc_debug_processing(s, page, freelist, addr)则转到:new_slab
2625  Remove the cpu slab
2626  返回:freelist
调用者
名称描述
__slab_allocAnother one that disabled interrupt and compensates for possible* cpu changes by refetching the per cpu area pointer.
kmem_cache_alloc_bulkNote that interrupts must be enabled when calling this function.