函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称: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)

函数原型:static enum fullness_group get_fullness_group(struct size_class *class, struct zspage *zspage)

返回类型:enum fullness_group

参数:

类型参数名称
struct size_class *class
struct zspage *zspage
699  inuse等于Protected by class->lock
700  objs_per_zspage等于objs_per_zspage
702  如果inuse恒等于0则fg等于ZS_EMPTY
704  否则如果inuse恒等于objs_per_zspagefg等于ZS_FULL
706  否则如果inuse小于等于3乘objs_per_zspageWe assign a page to ZS_ALMOST_EMPTY fullness group when:* n <= N / f, where* n = number of allocated objects* N = total number of objects zspage can store* f = fullness_threshold_frac* Similarly, we assign zspage to:* ZS_ALMOST_FULL when n > N / f* fg等于ZS_ALMOST_EMPTY
708  否则fg等于ZS_ALMOST_FULL
711  返回:fg
调用者
名称描述
fix_fullness_groupEach 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
zs_malloczs_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.
putback_zspageputback_zspage - add @zspage into right class's fullness list*@class: destination class*@zspage: target page* Return @zspage's fullness_group