Re: [PATCH 2/2] rcutorture: Nudge ksoftirqd priority for RCU boost testing

From: Valentin Schneider
Date: Wed Aug 04 2021 - 06:18:32 EST


On 03/08/21 16:42, Paul E. McKenney wrote:
> On Tue, Aug 03, 2021 at 11:54:37PM +0100, Valentin Schneider wrote:
>> diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
>> index 680f66b65f14..3dd5fa75f469 100644
>> --- a/kernel/rcu/rcutorture.c
>> +++ b/kernel/rcu/rcutorture.c
>> @@ -948,12 +948,26 @@ static int rcu_torture_boost(void *arg)
>> unsigned long endtime;
>> unsigned long oldstarttime;
>> struct rcu_boost_inflight rbi = { .inflight = 0 };
>> + struct task_struct *ksoftirqd = this_cpu_ksoftirqd();
>>
>> VERBOSE_TOROUT_STRING("rcu_torture_boost started");
>>
>> /* Set real-time priority. */
>> sched_set_fifo_low(current);
>>
>> + /*
>> + * Boost testing requires TIMER_SOFTIRQ to run at a higher priority
>> + * than the CPU-hogging torture kthreads, otherwise said threads
>> + * will never let timer expiry for the RCU GP kthread happen, which will
>> + * prevent any boosting.
>> + */
>> + if (current->normal_prio < ksoftirqd->normal_prio) {
>
> Would it make sense to add IS_ENABLED(CONFIG_PREEMPT_RT) to the above
> condition?
>

Hm so v5.13-rt1 has this commit:

5e59fba573e6 ("rcutorture: Fix testing of RCU priority boosting")

which gates RCU boost torture testing under CONFIG_PREEMPT_RT. Now, AFAICT
the TIMER_SOFTIRQ priority problem is there regardless of
CONFIG_PREEMPT_RT, so this patch would (should?) make sense even on
!CONFIG_PREEMPT_RT.

> Thanx, Paul
>
>> + struct sched_param sp = { .sched_priority = 2 };
>> +
>> + pr_alert("%s(): Adjusting %s priority\n", __func__, ksoftirqd->comm);
>> + sched_setscheduler_nocheck(ksoftirqd, SCHED_FIFO, &sp);
>> + }
>> +
>> init_rcu_head_on_stack(&rbi.rcu);
>> /* Each pass through the following loop does one boost-test cycle. */
>> do {
>> --
>> 2.25.1
>>