函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Slow path handling. This may still be called frequently since objects* have a longer lifetime than the cpu slabs in most processing loads.* So we still attempt to reduce cache line usage. Just take the slab* lock and free the item

函数原型:static void __slab_free(struct kmem_cache *s, struct page *page, void *head, void *tail, int cnt, unsigned long addr)

返回类型:void

参数:

类型参数名称
struct kmem_cache *s
struct page *page
void *head
void *tail
intcnt
unsigned longaddr
2838  struct kmem_cache_node * n = NULL
2839  flags等于flags
2841  stat(s, Freeing not to cpu slab )
2843  如果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且非free_debug_processing(s, page, head, tail, cnt, addr)则返回
2847  循环
2850  n = NULL
2852  prior等于 first free object
2853  counters等于 SLUB
2854  set_freepointer(s, tail, prior)
2855  SLUB 等于counters
2856  was_frozen等于frozen
2857  SLUB 减等于cnt
2858  如果非 SLUB 或非prior的值且非was_frozen
2860  如果kmem_cache_has_cpu_partial(s)且非prior
2868  frozen等于1
2870  否则
2886  当非cmpxchg_double_slab(s, page, prior, counters, head, SLUB , "__slab_free")循环
2891  如果此条件成立可能性大(为编译器优化)(!n)则
2897  如果frozen且非was_frozen
2898  put_cpu_partial(s, page, 1)
2905  如果was_frozenstat(s, Freeing to frozen slab )
2907  返回
2910  如果此条件成立可能性小(为编译器优化)(! SLUB && nr_partial >= min_partial)则转到:slab_empty
2917  如果非kmem_cache_has_cpu_partial(s)且此条件成立可能性小(为编译器优化)(!prior)则
2918  remove_full(s, n, page)
2919  add_partial(n, page, Cpu slab was moved to the tail of partials )
2920  stat(s, Freeing moves slab to partial list )
2922  spin_unlock_irqrestore( & list_lock, flags)
2923  返回
2925  slab_empty :
2926  如果prior
2930  remove_partial(n, page)
2931  stat(s, Freeing removes last object )
2932  否则
2934  remove_full(s, n, page)
2937  spin_unlock_irqrestore( & list_lock, flags)
2938  stat(s, Slab freed to the page allocator )
2939  discard_slab(s, page)
调用者
名称描述
do_slab_freeFastpath with forced inlining to produce a kfree and kmem_cache_free that* can perform fastpath freeing without additional function calls.* The fastpath is only possible if we are freeing to the current cpu slab* of this processor