| Function report | 
| Source Code: lib\test_meminit.c | Create Date:2022-07-28 06:37:36 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:Test kmem_cache with given parameters:
Proto:static int __init do_kmem_cache_size(size_t size, bool want_ctor, bool want_rcu, bool want_zero, int *total_failures)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| size_t | size | |
| bool | want_ctor | use a constructor; | 
| bool | want_rcu | use SLAB_TYPESAFE_BY_RCU; | 
| bool | want_zero | use __GFP_ZERO. | 
| int * | total_failures | 
| 201 | bool fail = false | 
| 202 | alloc_mask = GFP_KERNEL | If use __GFP_ZERO. Then __GFP_ZERO Else 0 | 
| 205 | c = kmem_cache_create("test_cache", size, 1, use SLAB_TYPESAFE_BY_RCU; ? Defer freeing slabs to RCU : 0, use a constructor; ? Initialize the first 4 bytes of the object. : NULL) | 
| 210 | If Not use SLAB_TYPESAFE_BY_RCU; && Not use a constructor; Then | 
| 213 | ret = kmem_cache_alloc_bulk(c, alloc_mask, BULK_SIZE, bulk_array) | 
| 214 | If Not ret Then | 
| 215 | fail = true | 
| 216 | Else | 
| 220 | kmem_cache_free_bulk(c, ret, bulk_array) | 
| 224 | buf = kmem_cache_alloc(c, alloc_mask) | 
| 229 | If Not use SLAB_TYPESAFE_BY_RCU; Then | 
| 230 | kmem_cache_free(c, buf) | 
| 231 | Continue | 
| 244 | If buf_copy Then No 3D Now!(buf_copy, buf, size) | 
| 247 | kmem_cache_free(c, buf) | 
| 255 | If buf_copy Then | 
| 261 | kmem_cache_destroy(c) | 
| 263 | total_failures += fail | 
| 264 | Return 1 | 
| Name | Describe | 
|---|---|
| test_kmemcache | Test kmem_cache allocation by creating caches of different sizes, with and* without constructors, with and without SLAB_TYPESAFE_BY_RCU. | 
| Source code conversion tool public plug-in interface | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |