函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:We have to decide on how many pages to link together* to form a zspage for each size class. This is important* to reduce wastage due to unusable space left at end of* each zspage which is given as:* wastage = Zp % class_size* usage = Zp - wastage

函数原型:static int get_pages_per_zspage(int class_size)

返回类型:int

参数:

类型参数名称
intclass_size
803  max_usedpc等于0
805  max_usedpc_order等于1
807 i小于等于ZS_MAX_PAGES_PER_ZSPAGE循环
811  zspage_size等于iPAGE_SIZE
812  waste等于zspage_size取模class_size
813  usedpc等于zspage_sizewaste的差乘100除zspage_size
815  如果usedpc大于max_usedpc
816  max_usedpc等于usedpc
817  max_usedpc_order等于i
821  返回:max_usedpc_order
调用者
名称描述
zs_create_poolzs_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.