Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\rcu\rcuperf.c Create Date:2022-07-28 10:23:59
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:rcu_perf_init

Proto:static int __init rcu_perf_init(void)

Type:int

Parameter:Nothing

591  firsterr = 0
592  static struct rcu_perf_ops * perf_ops[] = { & rcu_ops, & srcu_ops, & srcud_ops, & tasks_ops, }
596  If Not Initialize torture module Then Return -EBUSY
600  When i < ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(perf_ops) cycle
601  cur_ops = perf_ops[i]
602  If strcmp(perf_type, name) == 0 Then Break
605  If i == ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(perf_ops) Then
606  pr_alert("rcu-perf: invalid perf type: \"%s\"\n", perf_type)
607  pr_alert("rcu-perf types:")
608  When i < ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(perf_ops) cycle Like KERN_CONT, pr_cont() should only be used when continuing* a line with no newline ('\n') enclosed. Otherwise it defaults* back to KERN_DEFAULT.(" %s", name)
610  Like KERN_CONT, pr_cont() should only be used when continuing* a line with no newline ('\n') enclosed. Otherwise it defaults* back to KERN_DEFAULT.("\n")
611  WARN_ON(!IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0* otherwise.(CONFIG_RCU_PERF_TEST))
612  firsterr = -EINVAL
613  cur_ops = NULL
614  Go to unwind
616  If init Then init()
619  nrealwriters = Return the number if non-negative. If -1, the number of CPUs.* If less than -1, that much less than the number of CPUs, but* at least one.
620  nrealreaders = Return the number if non-negative. If -1, the number of CPUs.* If less than -1, that much less than the number of CPUs, but* at least one.
621  atomic_set( & n_rcu_perf_reader_started, 0)
622  atomic_set( & n_rcu_perf_writer_started, 0)
623  atomic_set( & n_rcu_perf_writer_finished, 0)
624  rcu_perf_print_module_parms(cur_ops, "Start of test")
628  If shutdown Then
629  init_waitqueue_head( & shutdown_wq)
630  firsterr = torture_create_kthread(RCU perf shutdown kthread. Just waits to be awakened, then shuts* down system., NULL, shutdown_task)
632  If firsterr Then Go to unwind
634  schedule_timeout_uninterruptible(1)
636  reader_tasks = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
638  If (reader_tasks == NULL) Then
639  VERBOSE_PERFOUT_ERRSTRING("out of memory")
640  firsterr = -ENOMEM
641  Go to unwind
643  When i < nrealreaders cycle
644  firsterr = torture_create_kthread(RCU perf reader kthread. Repeatedly does empty RCU read-side* critical section, minimizing update-side interference., (void * )i, reader_tasks[i])
646  If firsterr Then Go to unwind
649  When atomic_read( & n_rcu_perf_reader_started) < nrealreaders cycle
650  schedule_timeout_uninterruptible(1)
651  writer_tasks = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
653  writer_durations = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
655  writer_n_durations = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
658  If Not writer_tasks || Not writer_durations || Not writer_n_durations Then
659  VERBOSE_PERFOUT_ERRSTRING("out of memory")
660  firsterr = -ENOMEM
661  Go to unwind
663  When i < nrealwriters cycle
664  writer_durations[i] = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
667  If Not writer_durations[i] Then
668  firsterr = -ENOMEM
669  Go to unwind
671  firsterr = torture_create_kthread(RCU perf writer kthread. Repeatedly does a grace period., (void * )i, writer_tasks[i])
673  If firsterr Then Go to unwind
676  Tell the torture module that initialization is complete.
677  Return 0
679  unwind :
680  Tell the torture module that initialization is complete.
681  rcu_perf_cleanup()
682  Return firsterr