函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\slab.c Create Date:2022-07-27 17:18:32
Last Modify:2022-05-23 17:02:55 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:drain_freelist

函数原型:static int drain_freelist(struct kmem_cache *cache, struct kmem_cache_node *n, int tofree)

返回类型:int

参数:

类型参数名称
struct kmem_cache *cache
struct kmem_cache_node *n
inttofree
2237  nr_freed等于0
2238 nr_freed小于tofree且非链表为空循环
2240  spin_lock_irq( & list_lock)
2241  p等于链表前项
2242  如果p恒等于slabs_free
2244  转到:out
2247  page等于list_entry - get the struct for this entry*@ptr: the &struct list_head pointer.*@type: the type of the struct this is embedded in.*@member: the name of the list_head within the struct.(p, structpage, slab_list)
2248  删除链表项
2249  free_slabs自减
2250  total_slabs自减
2255  free_objects减等于num
2256  spin_unlock_irq( & list_lock)
2257  slab_destroy - destroy and release all objects in a slab*@cachep: cache pointer being destroyed*@page: page pointer being destroyed* Destroy all the objs in a slab page, and release the mem back to the system.
2258  nr_freed自加
2260  out :
2261  返回:nr_freed
调用者
名称描述
drain_cache_node_nodeDrains freelist for a node on each slab cache, used for memory hot-remove.* Returns -EBUSY if all objects cannot be drained so that the node is not* removed.* Must hold slab_mutex.
__kmem_cache_shrink
cache_reapache_reap - Reclaim memory from caches