Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\zsmalloc.c Create Date:2022-07-28 16:26:46
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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

Proto:static int get_size_class_index(int size)

Type:int

Parameter:

TypeParameterName
intsize
541  idx = 0
543  If Value is more likely to compile time(size > ZS_MIN_ALLOC_SIZE must be multiple of ZS_ALIGN ) Then 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  Return 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)
Caller
NameDescribe
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.