函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Allocate an array of spinlocks to be accessed by a hash. Two arguments* indicate the number of elements to allocate in the array. max_size* gives the maximum number of elements to allocate. cpu_mult gives* the number of locks per CPU to allocate

函数原型:int __alloc_bucket_spinlocks(spinlock_t **locks, unsigned int *locks_mask, size_t max_size, unsigned int cpu_mult, gfp_t gfp, const char *name, struct lock_class_key *key)

返回类型:int

参数:

类型参数名称
spinlock_t **locks
unsigned int *locks_mask
size_tmax_size
unsigned intcpu_mult
gfp_tgfp
const char *name
struct lock_class_key *key
18  spinlock_t * tlocks = NULL
23  nr_pcpus等于num_possible_cpus()
26  如果cpu_mult
27  nr_pcpus等于min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(unsignedint, nr_pcpus, 64UL)
28  size等于min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(unsignedint, nr_pcpus * cpu_mult, max_size)
29  否则
30  size等于max_size
33  如果sizeof(spinlock_t)不等于0则
34  tlocks等于kvmalloc_array(size, sizeof(spinlock_t), gfp)
35  如果非tlocks则返回:负ENOMEM
37 i小于size循环
38  spin_lock_init( & tlocks[i])
43  locks等于tlocks
44  locks_mask等于size减1
46  返回:0