Commit 5ab7ab83 authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

rcutorture: Affinity forward-progress test to avoid housekeeping CPUs



This commit affinities the forward-progress tests to avoid hogging a
housekeeping CPU on the theory that the offloaded callbacks will be
running on those housekeeping CPUs.

Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
[ paulmck: Fix NULL-pointer issue located by kbuild test robot. ]
Tested-by: default avatarRong Chen <rong.a.chen@intel.com>
parent 6b3de7a1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -539,8 +539,10 @@ extern struct workqueue_struct *rcu_par_gp_wq;

#ifdef CONFIG_RCU_NOCB_CPU
bool rcu_is_nocb_cpu(int cpu);
void rcu_bind_current_to_nocb(void);
#else
static inline bool rcu_is_nocb_cpu(int cpu) { return false; }
static inline void rcu_bind_current_to_nocb(void) { }
#endif

#endif /* __LINUX_RCU_H */
+1 −0
Original line number Diff line number Diff line
@@ -1803,6 +1803,7 @@ static int rcu_torture_fwd_prog(void *args)
	int tested_tries = 0;

	VERBOSE_TOROUT_STRING("rcu_torture_fwd_progress task started");
	rcu_bind_current_to_nocb();
	if (!IS_ENABLED(CONFIG_SMP) || !IS_ENABLED(CONFIG_RCU_BOOST))
		set_user_nice(current, MAX_NICE);
	do {
+11 −0
Original line number Diff line number Diff line
@@ -2603,6 +2603,17 @@ static bool init_nocb_callback_list(struct rcu_data *rdp)
	return true;
}

/*
 * Bind the current task to the offloaded CPUs.  If there are no offloaded
 * CPUs, leave the task unbound.  Splat if the bind attempt fails.
 */
void rcu_bind_current_to_nocb(void)
{
	if (cpumask_available(rcu_nocb_mask) && cpumask_weight(rcu_nocb_mask))
		WARN_ON(sched_setaffinity(current->pid, rcu_nocb_mask));
}
EXPORT_SYMBOL_GPL(rcu_bind_current_to_nocb);

#else /* #ifdef CONFIG_RCU_NOCB_CPU */

static bool rcu_nocb_cpu_needs_barrier(int cpu)