函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

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

函数原型:static int get_size_class_index(int size)

返回类型:int

参数:

类型参数名称
intsize
541  idx等于0
543  如果此条件成立可能性大(为编译器优化)(size > ZS_MIN_ALLOC_SIZE must be multiple of ZS_ALIGN )则idx等于DIV_ROUND_UP(size - ZS_MIN_ALLOC_SIZE must be multiple of ZS_ALIGN , On systems with 4K page size, this gives 255 size classes! There is a* trader-off here:* - Large number of size classes is potentially wasteful as free page are* spread across these classes* - Small number of size classes causes large internal )
547  返回:min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(int, ZS_SIZE_CLASSES - 1, idx)
调用者
名称描述
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.