Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\padata.c Create Date:2022-07-28 13:48:05
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:padata_alloc - allocate and initialize a padata instance and specify* cpumasks for serial and parallel workers

Proto:static struct padata_instance *padata_alloc(const char *name, const struct cpumask *pcpumask, const struct cpumask *cbcpumask)

Type:struct padata_instance

Parameter:

TypeParameterName
const char *name
const struct cpumask *pcpumask
const struct cpumask *cbcpumask
973  pinst = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
974  If Not pinst Then Go to err
977  parallel_wq = alloc_workqueue("%s_parallel", WQ_UNBOUND, 0, name)
979  If Not parallel_wq Then Go to err_free_inst
982  get_online_cpus()
984  serial_wq = alloc_workqueue("%s_serial", WQ_MEM_RECLAIM | WQ_CPU_INTENSIVE, 1, name)
986  If Not serial_wq Then Go to err_put_cpus
989  If Not alloc_cpumask_var( & pcpu, GFP_KERNEL) Then Go to err_free_serial_wq
991  If Not alloc_cpumask_var( & cbcpu, GFP_KERNEL) Then
992  free_cpumask_var(pcpu)
993  Go to err_free_serial_wq
995  If Not If cpumask contains no active cpu, we mark the instance as invalid. || Not If cpumask contains no active cpu, we mark the instance as invalid. Then Go to err_free_masks
999  If Not alloc_cpumask_var( & pcpu, GFP_KERNEL) Then Go to err_free_masks
1001  If Not alloc_cpumask_var( & cbcpu, GFP_KERNEL) Then Go to err_free_rcpumask_pcpu
1003  If Not alloc_cpumask_var( & omask, GFP_KERNEL) Then Go to err_free_rcpumask_cbcpu
1006  Initialization list head
1008  pumask_copy - *dstp = *srcp*@dstp: the result*@srcp: the input cpumask
1009  pumask_copy - *dstp = *srcp*@dstp: the result*@srcp: the input cpumask
1010  pumask_and - *dstp = *src1p & *src2p*@dstp: the cpumask result*@src1p: the first input*@src2p: the second input* If *@dstp is empty, returns 0, else returns 1
1011  pumask_and - *dstp = *src1p & *src2p*@dstp: the cpumask result*@src1p: the first input*@src2p: the second input* If *@dstp is empty, returns 0, else returns 1
1013  If padata_setup_cpumasks(pinst) Then Go to err_free_omask
1016  flags = 0
1018  BLOCKING_INIT_NOTIFIER_HEAD( & cpumask_change_notifier)
1019  kobject_init() - Initialize a kobject structure
1020  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.( & lock)
1028  put_online_cpus()
1030  Return pinst
1032  err_free_omask :
1033  free_cpumask_var(omask)
1034  err_free_rcpumask_cbcpu :
1035  free_cpumask_var(cbcpu)
1036  err_free_rcpumask_pcpu :
1037  free_cpumask_var(pcpu)
1038  err_free_masks :
1039  free_cpumask_var(pcpu)
1040  free_cpumask_var(cbcpu)
1041  err_free_serial_wq :
1042  destroy_workqueue - safely terminate a workqueue*@wq: target workqueue* Safely destroy a workqueue. All work currently pending will be done first.
1043  err_put_cpus :
1044  put_online_cpus()
1045  destroy_workqueue - safely terminate a workqueue*@wq: target workqueue* Safely destroy a workqueue. All work currently pending will be done first.
1046  err_free_inst :
1047  kfree(pinst)
1048  err :
1049  Return NULL
Caller
NameDescribe
padata_alloc_possiblepadata_alloc_possible - Allocate and initialize padata instance.* Use the cpu_possible_mask for serial and* parallel workers.*@name: used to identify the instance