diff options
| -rw-r--r-- | kernel/rcu/rcu.h | 2 | ||||
| -rw-r--r-- | kernel/rcu/rcutorture.c | 32 | ||||
| -rw-r--r-- | kernel/rcu/tree.c | 7 |
3 files changed, 37 insertions, 4 deletions
diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h index 0453a7d12b3f..bee070979970 100644 --- a/kernel/rcu/rcu.h +++ b/kernel/rcu/rcu.h | |||
| @@ -502,6 +502,7 @@ static inline void rcu_force_quiescent_state(void) { } | |||
| 502 | static inline void rcu_bh_force_quiescent_state(void) { } | 502 | static inline void rcu_bh_force_quiescent_state(void) { } |
| 503 | static inline void rcu_sched_force_quiescent_state(void) { } | 503 | static inline void rcu_sched_force_quiescent_state(void) { } |
| 504 | static inline void show_rcu_gp_kthreads(void) { } | 504 | static inline void show_rcu_gp_kthreads(void) { } |
| 505 | static inline int rcu_get_gp_kthreads_prio(void) { return 0; } | ||
| 505 | #else /* #ifdef CONFIG_TINY_RCU */ | 506 | #else /* #ifdef CONFIG_TINY_RCU */ |
| 506 | unsigned long rcu_get_gp_seq(void); | 507 | unsigned long rcu_get_gp_seq(void); |
| 507 | unsigned long rcu_bh_get_gp_seq(void); | 508 | unsigned long rcu_bh_get_gp_seq(void); |
| @@ -510,6 +511,7 @@ unsigned long rcu_exp_batches_completed(void); | |||
| 510 | unsigned long rcu_exp_batches_completed_sched(void); | 511 | unsigned long rcu_exp_batches_completed_sched(void); |
| 511 | unsigned long srcu_batches_completed(struct srcu_struct *sp); | 512 | unsigned long srcu_batches_completed(struct srcu_struct *sp); |
| 512 | void show_rcu_gp_kthreads(void); | 513 | void show_rcu_gp_kthreads(void); |
| 514 | int rcu_get_gp_kthreads_prio(void); | ||
| 513 | void rcu_force_quiescent_state(void); | 515 | void rcu_force_quiescent_state(void); |
| 514 | void rcu_bh_force_quiescent_state(void); | 516 | void rcu_bh_force_quiescent_state(void); |
| 515 | void rcu_sched_force_quiescent_state(void); | 517 | void rcu_sched_force_quiescent_state(void); |
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 049b3735dba8..e3d2d4f1d928 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c | |||
| @@ -1787,6 +1787,32 @@ static void rcu_torture_barrier_cleanup(void) | |||
| 1787 | } | 1787 | } |
| 1788 | } | 1788 | } |
| 1789 | 1789 | ||
| 1790 | static bool rcu_torture_can_boost(void) | ||
| 1791 | { | ||
| 1792 | static int boost_warn_once; | ||
| 1793 | int prio; | ||
| 1794 | |||
| 1795 | if (!(test_boost == 1 && cur_ops->can_boost) && test_boost != 2) | ||
| 1796 | return false; | ||
| 1797 | |||
| 1798 | prio = rcu_get_gp_kthreads_prio(); | ||
| 1799 | if (!prio) | ||
| 1800 | return false; | ||
| 1801 | |||
| 1802 | if (prio < 2) { | ||
| 1803 | if (boost_warn_once == 1) | ||
| 1804 | return false; | ||
| 1805 | |||
| 1806 | pr_alert("%s: WARN: RCU kthread priority too low to test boosting. " | ||
| 1807 | "Skipping RCU boost test. Try passing rcutree.kthread_prio > 1 " | ||
| 1808 | "on the kernel command line.\n", KBUILD_MODNAME); | ||
| 1809 | boost_warn_once = 1; | ||
| 1810 | return false; | ||
| 1811 | } | ||
| 1812 | |||
| 1813 | return true; | ||
| 1814 | } | ||
| 1815 | |||
| 1790 | static enum cpuhp_state rcutor_hp; | 1816 | static enum cpuhp_state rcutor_hp; |
| 1791 | 1817 | ||
| 1792 | static void | 1818 | static void |
| @@ -1831,8 +1857,7 @@ rcu_torture_cleanup(void) | |||
| 1831 | torture_stop_kthread(rcu_torture_fqs, fqs_task); | 1857 | torture_stop_kthread(rcu_torture_fqs, fqs_task); |
| 1832 | for (i = 0; i < ncbflooders; i++) | 1858 | for (i = 0; i < ncbflooders; i++) |
| 1833 | torture_stop_kthread(rcu_torture_cbflood, cbflood_task[i]); | 1859 | torture_stop_kthread(rcu_torture_cbflood, cbflood_task[i]); |
| 1834 | if ((test_boost == 1 && cur_ops->can_boost) || | 1860 | if (rcu_torture_can_boost()) |
| 1835 | test_boost == 2) | ||
| 1836 | cpuhp_remove_state(rcutor_hp); | 1861 | cpuhp_remove_state(rcutor_hp); |
| 1837 | 1862 | ||
| 1838 | /* | 1863 | /* |
| @@ -2056,8 +2081,7 @@ rcu_torture_init(void) | |||
| 2056 | test_boost_interval = 1; | 2081 | test_boost_interval = 1; |
| 2057 | if (test_boost_duration < 2) | 2082 | if (test_boost_duration < 2) |
| 2058 | test_boost_duration = 2; | 2083 | test_boost_duration = 2; |
| 2059 | if ((test_boost == 1 && cur_ops->can_boost) || | 2084 | if (rcu_torture_can_boost()) { |
| 2060 | test_boost == 2) { | ||
| 2061 | 2085 | ||
| 2062 | boost_starttime = jiffies + test_boost_interval * HZ; | 2086 | boost_starttime = jiffies + test_boost_interval * HZ; |
| 2063 | 2087 | ||
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 65abb399b08d..b4bcb5e21ca6 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
| @@ -180,6 +180,13 @@ module_param(gp_init_delay, int, 0444); | |||
| 180 | static int gp_cleanup_delay; | 180 | static int gp_cleanup_delay; |
| 181 | module_param(gp_cleanup_delay, int, 0444); | 181 | module_param(gp_cleanup_delay, int, 0444); |
| 182 | 182 | ||
| 183 | /* Retreive RCU kthreads priority for rcutorture */ | ||
| 184 | int rcu_get_gp_kthreads_prio(void) | ||
| 185 | { | ||
| 186 | return kthread_prio; | ||
| 187 | } | ||
| 188 | EXPORT_SYMBOL_GPL(rcu_get_gp_kthreads_prio); | ||
| 189 | |||
| 183 | /* | 190 | /* |
| 184 | * Number of grace periods between delays, normalized by the duration of | 191 | * Number of grace periods between delays, normalized by the duration of |
| 185 | * the delay. The longer the delay, the more the grace periods between | 192 | * the delay. The longer the delay, the more the grace periods between |
