函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:zs_malloc - Allocate block of given size from pool.*@pool: pool to allocate from*@size: size of block to allocate*@gfp: gfp flags when allocating object* On success, handle to the allocated object is returned,* otherwise 0.

函数原型:unsigned long zs_malloc(struct zs_pool *pool, size_t size, gfp_t gfp)

返回类型:unsigned long

参数:

类型参数名称
struct zs_pool *pool
size_tsize
gfp_tgfp
1466  如果此条件成立可能性小(为编译器优化)(!size || size > ach chunk includes extra space to keep handle )则返回:0
1469  handle等于cache_alloc_handle(pool, gfp)
1470  如果非handle则返回:0
1474  size加等于ZS_HANDLE_SIZE
1475  class等于size_class[zsmalloc divides the pool into various size classes where each* class maintains a list of zspages where each zspage is divided* into equal sized chunks. Each allocation falls into one of these* classes depending on its size]
1477  加自旋锁
1478  zspage等于find_get_zspage(class)
1479  如果此条件成立可能性大(为编译器优化)(zspage)则
1480  obj等于obj_malloc(class, zspage, handle)
1482  Each size class maintains zspages in different fullness groups depending* on the number of live objects they contain. When allocating or freeing* objects, the fullness status of the page can change, say, from ALMOST_FULL
1483  record_obj(handle, obj)
1484  自旋锁解锁
1486  返回:handle
1489  自旋锁解锁
1491  zspage等于Allocate a zspage for the given size class
1492  如果非zspage
1493  cache_free_handle(pool, handle)
1494  返回:0
1497  加自旋锁
1498  obj等于obj_malloc(class, zspage, handle)
1499  newfg等于For each size class, zspages are divided into different groups* depending on how "full" they are. This was done so that we could* easily find empty or nearly empty zspages when we try to shrink* the pool (not yet implemented)
1500  Each size class maintains various freelists and zspages are assigned* to one of these freelists based on the number of live objects they* have. This functions inserts the given zspage into the freelist* identified by .
1501  set_zspage_mapping(zspage, index, newfg)
1502  record_obj(handle, obj)
1503  atomic_long_add( Number of PAGE_SIZE sized pages to combine to form a 'zspage' , & pages_allocated)
1505  ype can be of enum type zs_stat_type or fullness_group
1508  SetZsPageMovable(pool, zspage)
1509  自旋锁解锁
1511  返回:handle
调用者
名称描述
zs_zpool_malloc