函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Test kmem_cache with given parameters:

函数原型:static int __init do_kmem_cache_size(size_t size, bool want_ctor, bool want_rcu, bool want_zero, int *total_failures)

返回类型:int

参数:

类型参数名称
size_tsize
boolwant_ctor use a constructor;
boolwant_rcu use SLAB_TYPESAFE_BY_RCU;
boolwant_zero use __GFP_ZERO.
int *total_failures
201  bool fail = false
202  alloc_mask等于GFP_KERNEL按位或如果 use __GFP_ZERO.__GFP_ZERO否则0
205  c等于创建高速缓存区
208 iter小于10循环
214  如果非ret
215  fail = true
216  否则
224  buf等于kmem_cache_alloc(c, alloc_mask)
226  fail或等于Check the invariants for the buffer allocated from a slab cache.* If the cache has a test constructor, the first 4 bytes of the object must* always remain equal to CTOR_PATTERN.* If the cache isn't an RCU-typesafe one, or if the allocation is done with
227  Fill a buffer with garbage, skipping |skip| first bytes.
229  如果非 use SLAB_TYPESAFE_BY_RCU;
231  继续下一循环
238  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
243  buf_copy等于kmalloc(size, DOC: Useful GFP flag combinations* Useful GFP flag combinations* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~* Useful GFP flag combinations that are commonly used. It is recommended* that subsystems start with one of these combinations and then set/clear)
244  如果buf_copy内存复制(buf_copy, buf, size)
247  kmem_cache_free(c, buf)
253  fail或等于Check the invariants for the buffer allocated from a slab cache.* If the cache has a test constructor, the first 4 bytes of the object must* always remain equal to CTOR_PATTERN.* If the cache isn't an RCU-typesafe one, or if the allocation is done with
255  如果buf_copy
256  fail或等于memcmp(buf, buf_copy, size)
257  kfree(buf_copy)
259  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
261  删除高速缓存区
263  total_failures加等于fail
264  返回:1
调用者
名称描述
test_kmemcacheTest kmem_cache allocation by creating caches of different sizes, with and* without constructors, with and without SLAB_TYPESAFE_BY_RCU.