函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:alloc_swap_slot_cache

函数原型:static int alloc_swap_slot_cache(unsigned int cpu)

返回类型:int

参数:

类型参数名称
unsigned intcpu
125  slots等于kvcalloc(SWAP_SLOTS_CACHE_SIZE, sizeof(swp_entry_t), GFP_KERNEL)
127  如果非slots则返回:负ENOMEM
130  slots_ret等于kvcalloc(SWAP_SLOTS_CACHE_SIZE, sizeof(swp_entry_t), GFP_KERNEL)
132  如果非slots_ret
133  kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
134  返回:负ENOMEM
137  mutex_lock( & swap_slots_cache_mutex)
138  cache等于per_cpu(swp_slots, cpu)
139  如果slotsslots_ret则转到:out
142  如果非lock_initialized
143  mutex_init - initialize the mutex*@mutex: the mutex to be initialized* Initialize the mutex to unlocked state.* It is not allowed to initialize an already locked mutex.( & protects slots, nr, cur )
144  spin_lock_init( & protects slots_ret, n_ret )
145  lock_initialized = true
147  nr等于0
148  cur等于0
149  n_ret等于0
156  Force strict CPU ordering.* And yes, this might be required on UP too when we're talking* to devices.()
157  slots等于slots
158  slots = NULL
159  slots_ret等于slots_ret
160  slots_ret = NULL
161  out :
162  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
163  如果slotskvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
165  如果slots_retkvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
167  返回:0