函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:alloc_workqueue

函数原型:struct workqueue_struct *alloc_workqueue(const char *fmt, unsigned int flags, int max_active, ...)

返回类型:struct workqueue_struct

参数:

类型参数名称
const char *fmt
unsigned intflags
intmax_active
4225  tbl_size等于0
4237  如果flags按位与WQ_UNBOUNDmax_active恒等于1则flags或等于__WQ_ORDERED
4241  如果flags按位与WQ_POWER_EFFICIENTsee the comment above the definition of WQ_POWER_EFFICIENT flags或等于WQ_UNBOUND
4245  如果flags按位与WQ_UNBOUNDtbl_size等于nr_node_idsPWR: unbound pwqs indexed by node [0]的长度
4248  wq等于分配内存并置零
4249  如果非wq则返回:NULL
4252  如果flags按位与WQ_UNBOUND
4253  PW: only for unbound wqs 等于alloc_workqueue_attrs - allocate a workqueue_attrs* Allocate a new workqueue_attrs, initialize with default settings and* return it.* Return: The allocated new workqueue_attr on success. %NULL on failure.
4254  如果非PW: only for unbound wqs 则转到:err_free_wq
4258  va_start(args, max_active)
4259  vsnprintf - Format a string and place it in a buffer*@buf: The buffer to place the result into*@size: The size of the buffer, including the trailing null space*@fmt: The format string to use*@args: Arguments for the format string* This function generally
4260  va_end(args)
4262  max_active等于如果max_active否则WQ_DFL_ACTIVE
4263  max_active等于wq_clamp_max_active(max_active, flags, I: workqueue name )
4266  hot fields used during command issue, aligned to cacheline 等于flags
4267  WQ: saved pwq max_active 等于max_active
4268  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 this wq )
4269  atomic_set( & lush in progress , 0)
4270  初始化链表头
4271  初始化链表头
4272  初始化链表头
4273  初始化链表头
4275  wq_init_lockdep(wq)
4276  初始化链表头
4278  如果alloc_and_link_pwqs(wq)小于0则转到:err_unreg_lockdep
4281  如果can kworkers be created yet? Workqueues which may be used during memory reclaim should have a rescuer* to guarantee forward progress.小于0则转到:err_destroy
4284  如果hot fields used during command issue, aligned to cacheline 按位与WQ_SYSFSworkqueue_sysfs_register(wq)则转到:err_destroy
4292  mutex_lock( & wq_pool_mutex)
4294  mutex_lock( & protects this wq )
4295  r_each_pwq - iterate through all pool_workqueues of the specified workqueue*@pwq: iteration cursor*@wq: the target workqueue* This must be called either with wq->mutex held or RCU read locked(pwq, wq)
4296  pwq_adjust_max_active - update a pwq's max_active to the current setting*@pwq: target pool_workqueue* If @pwq isn't freezing, set @pwq->max_active to the associated* workqueue's saved_max_active and activate delayed work items* accordingly
4297  mutex_unlock( & protects this wq )
4299  添加RCU链表项
4301  mutex_unlock( & wq_pool_mutex)
4303  返回:wq
4305  err_unreg_lockdep :
4306  wq_unregister_lockdep(wq)
4307  wq_free_lockdep(wq)
4308  err_free_wq :
4309  _workqueue_attrs - free a workqueue_attrs*@attrs: workqueue_attrs to free* Undo alloc_workqueue_attrs().
4310  释放内存
4311  返回:NULL
4312  err_destroy :
4313  destroy_workqueue - safely terminate a workqueue*@wq: target workqueue* Safely destroy a workqueue. All work currently pending will be done first.
4314  返回:NULL
调用者
名称描述
workqueue_init_earlyworkqueue_init_early - early init for workqueue subsystem* This is the first half of two-staged workqueue subsystem initialization* and invoked as soon as the bare basics - memory allocation, cpumasks and* idr are up
test_ww_mutex_init
pm_start_workqueue
rcu_init初始化直接读拷贝更新的锁机制
cgroup_wq_init
cgroup1_wq_init
padata_allocpadata_alloc - allocate and initialize a padata instance and specify* cpumasks for serial and parallel workers
default_bdi_init
blk_dev_init
blkcg_init
throtl_init
bio_integrity_init
fscrypt_initscrypt_init() - Set up for fs encryption.
fsverity_init_workqueue
init_mm_internals
bioset_initset_init - Initialize a bio_set*@bs: pool to initialize*@pool_size: Number of bio and bio_vecs to cache in the mempool*@front_pad: Number of bytes to allocate in front of the returned bio*@flags: Flags to modify behavior, currently %BIOSET_NEED_BVECS* and
sb_init_dio_done_wqCreate workqueue for deferred direct IO completions. We allocate the* workqueue when it's first needed. This avoids creating workqueue for* filesystems that don't need it and also allows us to create the workqueue