Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\test_meminit.c Create Date:2022-07-28 06:37:38
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Check that the data written to an RCU-allocated object survives* reallocation.

Proto:static int __init do_kmem_cache_rcu_persistent(int size, int *total_failures)

Type:int

Parameter:

TypeParameterName
intsize
int *total_failures
276  maxiter = 1024
277  bool fail = false
279  c = kmem_cache_create("test_cache", size, size, Defer freeing slabs to RCU , NULL)
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  If Not buf_contents Then Go to out
287  used_objects = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
288  If Not used_objects Then
289  kfree(buf_contents)
290  Go to out
292  No 3D Now!(buf_contents, buf, size)
293  kmem_cache_free(c, buf)
298  When iter < maxiter cycle
299  buf = kmem_cache_alloc(c, GFP_KERNEL)
300  used_objects[iter] = buf
301  If buf == saved_ptr Then
305  Go to free_out
309  free_out :
310  kmem_cache_destroy(c)
311  kfree(buf_contents)
312  kfree(used_objects)
313  out :
314  total_failures += fail
315  Return 1
Caller
NameDescribe
test_rcu_persistentTest the behavior of SLAB_TYPESAFE_BY_RCU caches of different sizes.