Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\slab.c Create Date:2022-07-28 15:43:12
Last Modify:2022-05-23 17:02:55 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Calculate the number of objects and left-over bytes for a given buffer size.

Proto:static unsigned int cache_estimate(unsigned long gfporder, size_t buffer_size, slab_flags_t flags, size_t *left_over)

Type:unsigned int

Parameter:

TypeParameterName
unsigned longgfporder
size_tbuffer_size
slab_flags_tflags
size_t *left_over
452  slab_size = PAGE_SIZE << gfporder
471  If flags & (CFLGS_OBJFREELIST_SLAB | CFLGS_OFF_SLAB) Then
472  num = slab_size / buffer_size
473  left_over = slab_size % buffer_size
474  Else
475  num = slab_size / (buffer_size + sizeof(freelist_idx_t))
476  left_over = slab_size % (buffer_size + sizeof(freelist_idx_t))
480  Return num
Caller
NameDescribe
calculate_slab_orderalculate_slab_order - calculate size (page order) of slabs*@cachep: pointer to the cache that is being created*@size: size of objects to be created in this cache.*@flags: slab allocation flags* Also calculates the number of objects per slab.