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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 03, 2021 at 11:54:37PM +0100, Valentin Schneider wrote:
> As pointed out by commit 5e59fba573e6 ("rcutorture: Fix testing of RCU
> priority boosting"), timer expiry needs to run at a priority higher than
> that of the rcu_torture_boost threads (FIFO1) for RCU boost testing to
> function. If that's not the case, the rcu_torture_boost threads will
> prevent the wakeup of the RCU grace-period kthread, which means no boosting
> will be initiated.
> 
> Instead of setting this up manually, check the priority of ksoftirqd before
> starting the RCU boost test and nudge if required.
> 
> Note that this does not attempt to save and restore the scheduler
> parameters of ksoftirqd.
> 
> Signed-off-by: Valentin Schneider <valentin.schneider@xxxxxxx>
> ---
>  kernel/rcu/rcutorture.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> 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?

							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
> 



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux