函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:lock_torture_init

函数原型:static int __init lock_torture_init(void)

返回类型:int

参数:

842  firsterr等于0
843  static struct lock_torture_ops * torture_ops[] = { & lock_busted_ops, & spin_lock_ops, & spin_lock_irq_ops, & rw_lock_ops, & rw_lock_irq_ops, & mutex_lock_ops, & ww_mutex_lock_ops, & rwsem_lock_ops, & percpu_rwsem_lock_ops, }
856  如果非Initialize torture module则返回:负EBUSY
860 i小于ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(torture_ops)循环
861  cur_ops等于torture_ops[i]
862  如果字符串比较恒等于0则退出
865  如果i恒等于ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(torture_ops)则
866  打印警报信息("lock-torture: invalid torture type: \"%s\"\n", torture_type)
868  打印警报信息("lock-torture types:")
869 i小于ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(torture_ops)循环打印警报信息(" %s", name)
871  打印警报信息("\n")
872  firsterr等于负EINVAL
873  转到:unwind
876  如果nwriters_stress恒等于0且nreaders_stress恒等于0则
877  打印警报信息("lock-torture: must run at least one locking thread\n")
878  firsterr等于负EINVAL
879  转到:unwind
882  如果initinit()
885  如果nwriters_stress大于等于0则nrealwriters_stress等于nwriters_stress
887  否则nrealwriters_stress等于2乘num_online_cpus()
905  如果nwriters_stress
906  lock_is_write_held等于0
907  writer statistics 等于分配数组内存
910  如果( writer statistics == NULL)则
911  VERBOSE_TOROUT_STRING("cxt.lwsa: Out of memory")
912  firsterr等于负ENOMEM
913  转到:unwind
917  n_lock_fail等于0
918  n_lock_acquired等于0
922  如果readlock
923  如果nreaders_stress大于等于0则nrealreaders_stress等于nreaders_stress
925  否则
936  如果nreaders_stress
937  lock_is_read_held等于0
941  如果( reader statistics == NULL)则
942  VERBOSE_TOROUT_STRING("cxt.lrsa: Out of memory")
943  firsterr等于负ENOMEM
944  释放内存
945  writer statistics = NULL
946  转到:unwind
950  n_lock_fail等于0
951  n_lock_acquired等于0
956  lock_torture_print_module_parms(cur_ops, "Start of test")
959  如果onoff_interval大于0则
960  firsterr等于torture_onoff_init(onoff_holdoff * HZ, onoff_interval * HZ, NULL)
962  如果firsterr则转到:unwind
965  如果shuffle_interval大于0则
966  firsterr等于torture_shuffle_init(shuffle_interval)
967  如果firsterr则转到:unwind
970  如果shutdown_secs大于0则
971  firsterr等于torture_shutdown_init(shutdown_secs, Forward reference. )
973  如果firsterr则转到:unwind
976  如果stutter大于0则
977  firsterr等于torture_stutter_init(stutter, stutter)
978  如果firsterr则转到:unwind
982  如果nwriters_stress
983  writer_tasks等于分配数组内存并置零
986  如果(writer_tasks == NULL)则
987  VERBOSE_TOROUT_ERRSTRING("writer_tasks: Out of memory")
988  firsterr等于负ENOMEM
989  转到:unwind
993  如果readlock
994  reader_tasks等于分配数组内存并置零
997  如果(reader_tasks == NULL)则
998  VERBOSE_TOROUT_ERRSTRING("reader_tasks: Out of memory")
999  释放内存
1000  writer_tasks = NULL
1001  firsterr等于负ENOMEM
1002  转到:unwind
1014 i小于nrealwriters_stressj小于nrealreaders_stress循环
1016  如果i大于等于nrealwriters_stress则转到:create_reader
1020  firsterr等于torture_create_kthread(Lock torture writer kthread. Repeatedly acquires and releases* the lock, checking for duplicate acquisitions., & writer statistics [i], writer_tasks[i])
1022  如果firsterr则转到:unwind
1025  create_reader :
1026  如果readlock恒等于NULLj大于等于nrealreaders_stress则继续下一循环
1029  firsterr等于torture_create_kthread(Lock torture reader kthread. Repeatedly acquires and releases* the reader lock., & reader statistics [j], reader_tasks[j])
1031  如果firsterr则转到:unwind
1034  如果stat_interval大于0则
1035  firsterr等于torture_create_kthread(Periodically prints torture statistics, if periodic statistics printing* was specified via the stat_interval module parameter.* No need to worry about fullstop here, since this one doesn't reference* volatile state or register callbacks., NULL, stats_task)
1037  如果firsterr则转到:unwind
1040  Tell the torture module that initialization is complete.
1041  返回:0
1043  unwind :
1044  Tell the torture module that initialization is complete.
1045  Forward reference.
1046  返回:firsterr