Function report |
Source Code:kernel\rcu\rcutorture.c |
Create Date:2022-07-28 10:21:34 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:RCU torture writer kthread. Repeatedly substitutes a new structure* for that pointed to by rcu_torture_current, freeing the old structure* after a series of grace periods (the "pipeline").
Proto:static int rcu_torture_writer(void *arg)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| void * | arg |
| 942 | expediting = 0 |
| 949 | static |
| 950 | int synctype[] = {RTWS_DEF_FREE, RTWS_EXP_SYNC, RTWS_COND_GET, RTWS_SYNC} |
| 952 | nsynctypes = 0 |
| 954 | VERBOSE_TOROUT_STRING("rcu_torture_writer task started") |
| 955 | If Not can_expedite Then pr_alert("%s"TORTURE_FLAG" GP expediting controlled from boot/sysfs for %s.\n", torture_type, name) |
| 961 | If Not gp_cond1 && Not gp_exp1 && Not gp_normal1 && Not gp_sync1 Then gp_cond1 = gp_exp1 = gp_normal1 = gp_sync1 = true |
| 964 | synctype[nsynctypes++] = RTWS_COND_GET |
| 970 | synctype[nsynctypes++] = RTWS_EXP_SYNC |
| 975 | If gp_normal1 && deferred_free Then |
| 976 | synctype[nsynctypes++] = RTWS_DEF_FREE |
| 978 | Else if gp_normal && Not deferred_free Then |
| 982 | synctype[nsynctypes++] = RTWS_SYNC |
| 987 | If WARN_ONCE(nsynctypes == 0, "rcu_torture_writer: No update-side primitives.\n") Then |
| 998 | Do |
| 1000 | schedule_timeout_uninterruptible(1) |
| 1002 | If (rp == NULL) Then Continue |
| 1004 | rtort_pipe_count = 0 |
| 1006 | 0x10c7 is 2**32 / 1000000 (rounded up) (torture_random( & rand) & 0x3ff) |
| 1010 | rtort_mbtest = 1 |
| 1012 | smp_wmb() |
| 1013 | If old_rp Then |
| 1014 | i = rtort_pipe_count |
| 1015 | If i > RCU_TORTURE_PIPE_LEN Then i = RCU_TORTURE_PIPE_LEN |
| 1017 | atomic_inc( & rcu_torture_wcount[i]) |
| 1018 | rtort_pipe_count++ |
| 1020 | Case synctype[torture_random( & rand) % nsynctypes] == RTWS_DEF_FREE |
| 1024 | Case synctype[torture_random( & rand) % nsynctypes] == RTWS_EXP_SYNC |
| 1026 | exp_sync() |
| 1028 | Break |
| 1029 | Case synctype[torture_random( & rand) % nsynctypes] == RTWS_COND_GET |
| 1032 | i = torture_random( & rand) % 16 |
| 1033 | If i != 0 Then schedule_timeout_interruptible(i) |
| 1035 | 0x10c7 is 2**32 / 1000000 (rounded up) (torture_random( & rand) % 1000) |
| 1039 | Break |
| 1040 | Case synctype[torture_random( & rand) % nsynctypes] == RTWS_SYNC |
| 1042 | sync() |
| 1044 | Break |
| 1045 | Default |
| 1046 | WARN_ON_ONCE(1) |
| 1047 | Break |
| 1053 | If can_expedite && Not ( torture_random( & rand) & 0xff & Not Not expediting - 1 ) Then |
| 1058 | Else _unexpedite_gp - Cancel prior rcu_expedite_gp() invocation* Undo a prior call to rcu_expedite_gp() |
| 1060 | If ++expediting > 3 Then expediting = -expediting |
| 1062 | Else if Not can_expedite Then |
| 1076 | WARN(1, "%s: rtort_pipe_count: %d\n", __func__, rtort_pipe_count) |
| 1078 | When Not Is it time for the current torture test to stop? cycle |
| 1080 | If expediting > 0 Then expediting = -expediting |
| 1082 | When can_expedite && expediting++ < 0 cycle |
| 1083 | _unexpedite_gp - Cancel prior rcu_expedite_gp() invocation* Undo a prior call to rcu_expedite_gp() |
| 1085 | If Not can_expedite Then pr_alert("%s"TORTURE_FLAG" Dynamic grace-period expediting was disabled.\n", torture_type) |
| 1091 | Return 0 |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |