函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Check that the data written to an RCU-allocated object survives* reallocation.

函数原型:static int __init do_kmem_cache_rcu_persistent(int size, int *total_failures)

返回类型:int

参数:

类型参数名称
intsize
int *total_failures
276  maxiter等于1024
277  bool fail = false
279  c等于创建高速缓存区
281  buf等于kmem_cache_alloc(c, GFP_KERNEL)
282  saved_ptr等于buf
283  fill_with_garbage(buf, size)
284  buf_contents等于kmalloc(size, GFP_KERNEL)
285  如果非buf_contents则转到:out
287  used_objects等于分配数组内存
288  如果非used_objects
289  kfree(buf_contents)
290  转到:out
292  内存复制(buf_contents, buf, size)
293  kmem_cache_free(c, buf)
298 iter小于maxiter循环
299  buf等于kmem_cache_alloc(c, GFP_KERNEL)
300  used_objects[iter]等于buf
301  如果buf恒等于saved_ptr
302  fail等于memcmp(buf_contents, buf, size)
303 i小于等于iter循环kmem_cache_free(c, used_objects[i])
305  转到:free_out
309  free_out :
310  删除高速缓存区
311  kfree(buf_contents)
312  kfree(used_objects)
313  out :
314  total_failures加等于fail
315  返回:1
调用者
名称描述
test_rcu_persistentTest the behavior of SLAB_TYPESAFE_BY_RCU caches of different sizes.