diff options
Diffstat (limited to 'kernel/rcu/rcutorture.c')
| -rw-r--r-- | kernel/rcu/rcutorture.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 30d42aa55d83..8dbe27611ec3 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c | |||
| @@ -853,6 +853,8 @@ rcu_torture_fqs(void *arg) | |||
| 853 | static int | 853 | static int |
| 854 | rcu_torture_writer(void *arg) | 854 | rcu_torture_writer(void *arg) |
| 855 | { | 855 | { |
| 856 | bool can_expedite = !rcu_gp_is_expedited(); | ||
| 857 | int expediting = 0; | ||
| 856 | unsigned long gp_snap; | 858 | unsigned long gp_snap; |
| 857 | bool gp_cond1 = gp_cond, gp_exp1 = gp_exp, gp_normal1 = gp_normal; | 859 | bool gp_cond1 = gp_cond, gp_exp1 = gp_exp, gp_normal1 = gp_normal; |
| 858 | bool gp_sync1 = gp_sync; | 860 | bool gp_sync1 = gp_sync; |
| @@ -865,9 +867,15 @@ rcu_torture_writer(void *arg) | |||
| 865 | int nsynctypes = 0; | 867 | int nsynctypes = 0; |
| 866 | 868 | ||
| 867 | VERBOSE_TOROUT_STRING("rcu_torture_writer task started"); | 869 | VERBOSE_TOROUT_STRING("rcu_torture_writer task started"); |
| 870 | pr_alert("%s" TORTURE_FLAG | ||
| 871 | " Grace periods expedited from boot/sysfs for %s,\n", | ||
| 872 | torture_type, cur_ops->name); | ||
| 873 | pr_alert("%s" TORTURE_FLAG | ||
| 874 | " Testing of dynamic grace-period expediting diabled.\n", | ||
| 875 | torture_type); | ||
| 868 | 876 | ||
| 869 | /* Initialize synctype[] array. If none set, take default. */ | 877 | /* Initialize synctype[] array. If none set, take default. */ |
| 870 | if (!gp_cond1 && !gp_exp1 && !gp_normal1 && !gp_sync) | 878 | if (!gp_cond1 && !gp_exp1 && !gp_normal1 && !gp_sync1) |
| 871 | gp_cond1 = gp_exp1 = gp_normal1 = gp_sync1 = true; | 879 | gp_cond1 = gp_exp1 = gp_normal1 = gp_sync1 = true; |
| 872 | if (gp_cond1 && cur_ops->get_state && cur_ops->cond_sync) | 880 | if (gp_cond1 && cur_ops->get_state && cur_ops->cond_sync) |
| 873 | synctype[nsynctypes++] = RTWS_COND_GET; | 881 | synctype[nsynctypes++] = RTWS_COND_GET; |
| @@ -949,9 +957,26 @@ rcu_torture_writer(void *arg) | |||
| 949 | } | 957 | } |
| 950 | } | 958 | } |
| 951 | rcutorture_record_progress(++rcu_torture_current_version); | 959 | rcutorture_record_progress(++rcu_torture_current_version); |
| 960 | /* Cycle through nesting levels of rcu_expedite_gp() calls. */ | ||
| 961 | if (can_expedite && | ||
| 962 | !(torture_random(&rand) & 0xff & (!!expediting - 1))) { | ||
| 963 | WARN_ON_ONCE(expediting == 0 && rcu_gp_is_expedited()); | ||
| 964 | if (expediting >= 0) | ||
| 965 | rcu_expedite_gp(); | ||
| 966 | else | ||
| 967 | rcu_unexpedite_gp(); | ||
| 968 | if (++expediting > 3) | ||
| 969 | expediting = -expediting; | ||
| 970 | } | ||
| 952 | rcu_torture_writer_state = RTWS_STUTTER; | 971 | rcu_torture_writer_state = RTWS_STUTTER; |
| 953 | stutter_wait("rcu_torture_writer"); | 972 | stutter_wait("rcu_torture_writer"); |
| 954 | } while (!torture_must_stop()); | 973 | } while (!torture_must_stop()); |
| 974 | /* Reset expediting back to unexpedited. */ | ||
| 975 | if (expediting > 0) | ||
| 976 | expediting = -expediting; | ||
| 977 | while (can_expedite && expediting++ < 0) | ||
| 978 | rcu_unexpedite_gp(); | ||
| 979 | WARN_ON_ONCE(can_expedite && rcu_gp_is_expedited()); | ||
| 955 | rcu_torture_writer_state = RTWS_STOPPING; | 980 | rcu_torture_writer_state = RTWS_STOPPING; |
| 956 | torture_kthread_stopping("rcu_torture_writer"); | 981 | torture_kthread_stopping("rcu_torture_writer"); |
| 957 | return 0; | 982 | return 0; |
