Function report |
Source Code:mm\zsmalloc.c |
Create Date:2022-07-28 16:28:23 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:zs_create_pool - Creates an allocation pool to work from.*@name: pool name to be created* This function must be called before anything when using* the zsmalloc allocator.* On success, a pointer to the newly created pool is returned,* otherwise NULL.
Proto:struct zs_pool *zs_create_pool(const char *name)
Type:struct zs_pool
Parameter:
| Type | Parameter | Name |
|---|---|---|
| const char * | name |
| 2405 | struct size_class * prev_class = NULL |
| 2407 | pool = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
| 2408 | If Not pool Then Return NULL |
| 2411 | init_deferred_free(pool) |
| 2421 | If create_cache(pool) Then Go to err |
| 2433 | fullness = 0 |
| 2436 | If size > ach chunk includes extra space to keep handle Then size = ach chunk includes extra space to keep handle |
| 2439 | objs_per_zspage = pages_per_zspage * PAGE_SIZE / size |
| 2447 | If pages_per_zspage != 1 && objs_per_zspage != 1 && Not huge_class_size Then |
| 2449 | huge_class_size = size |
| 2459 | huge_class_size -= ZS_HANDLE_SIZE - 1 |
| 2471 | If prev_class Then |
| 2472 | If can_merge(prev_class, pages_per_zspage, objs_per_zspage) Then |
| 2473 | size_class[i] = prev_class |
| 2474 | Continue |
| 2478 | class = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
| 2485 | objs_per_zspage = objs_per_zspage |
| 2486 | Process spin lock initialization( & lock) |
| 2487 | size_class[i] = class |
| 2488 | When fullness < NR_ZS_FULLNESS cycle Initialization list head |
| 2492 | prev_class = class |
| 2496 | zs_pool_stat_create(pool, name) |
| 2498 | If zs_register_migration(pool) Then Go to err |
| 2507 | zs_register_shrinker(pool) |
| 2509 | Return pool |
| 2511 | err : |
| 2512 | zs_destroy_pool(pool) |
| 2513 | Return NULL |
| Name | Describe |
|---|---|
| zs_zpool_create | zpool driver |
| 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 |