torture: Move rcutorture_sched_setaffinity() out of rcutorture

The rcutorture_sched_setaffinity() function is needed by locktorture,
so move its declaration from rcu.h to torture.h and rename it to the
more generic torture_sched_setaffinity() name.

Please note that use of this function is still restricted to torture
tests, and of those, currently only rcutorture and locktorture.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
This commit is contained in:
Paul E. McKenney
2023-09-24 17:24:01 +02:00
committed by Frederic Weisbecker
parent 3853a720f8
commit 0cfecd7d75
4 changed files with 10 additions and 9 deletions
+5
View File
@@ -121,10 +121,15 @@ void _torture_stop_kthread(char *m, struct task_struct **tp);
#define torture_stop_kthread(n, tp) \ #define torture_stop_kthread(n, tp) \
_torture_stop_kthread("Stopping " #n " task", &(tp)) _torture_stop_kthread("Stopping " #n " task", &(tp))
/* Scheduler-related definitions. */
#ifdef CONFIG_PREEMPTION #ifdef CONFIG_PREEMPTION
#define torture_preempt_schedule() __preempt_schedule() #define torture_preempt_schedule() __preempt_schedule()
#else #else
#define torture_preempt_schedule() do { } while (0) #define torture_preempt_schedule() do { } while (0)
#endif #endif
#if IS_ENABLED(CONFIG_RCU_TORTURE_TEST) || IS_MODULE(CONFIG_RCU_TORTURE_TEST) || IS_ENABLED(CONFIG_LOCK_TORTURE_TEST) || IS_MODULE(CONFIG_LOCK_TORTURE_TEST)
long torture_sched_setaffinity(pid_t pid, const struct cpumask *in_mask);
#endif
#endif /* __LINUX_TORTURE_H */ #endif /* __LINUX_TORTURE_H */
-4
View File
@@ -568,10 +568,6 @@ void do_trace_rcu_torture_read(const char *rcutorturename,
static inline void rcu_gp_set_torture_wait(int duration) { } static inline void rcu_gp_set_torture_wait(int duration) { }
#endif #endif
#if IS_ENABLED(CONFIG_RCU_TORTURE_TEST) || IS_MODULE(CONFIG_RCU_TORTURE_TEST)
long rcutorture_sched_setaffinity(pid_t pid, const struct cpumask *in_mask);
#endif
#ifdef CONFIG_TINY_SRCU #ifdef CONFIG_TINY_SRCU
static inline void srcutorture_get_gp_data(enum rcutorture_type test_type, static inline void srcutorture_get_gp_data(enum rcutorture_type test_type,
+1 -1
View File
@@ -810,7 +810,7 @@ static void synchronize_rcu_trivial(void)
int cpu; int cpu;
for_each_online_cpu(cpu) { for_each_online_cpu(cpu) {
rcutorture_sched_setaffinity(current->pid, cpumask_of(cpu)); torture_sched_setaffinity(current->pid, cpumask_of(cpu));
WARN_ON_ONCE(raw_smp_processor_id() != cpu); WARN_ON_ONCE(raw_smp_processor_id() != cpu);
} }
} }
+4 -4
View File
@@ -525,17 +525,17 @@ EXPORT_SYMBOL_GPL(do_trace_rcu_torture_read);
do { } while (0) do { } while (0)
#endif #endif
#if IS_ENABLED(CONFIG_RCU_TORTURE_TEST) || IS_MODULE(CONFIG_RCU_TORTURE_TEST) #if IS_ENABLED(CONFIG_RCU_TORTURE_TEST) || IS_MODULE(CONFIG_RCU_TORTURE_TEST) || IS_ENABLED(CONFIG_LOCK_TORTURE_TEST) || IS_MODULE(CONFIG_LOCK_TORTURE_TEST)
/* Get rcutorture access to sched_setaffinity(). */ /* Get rcutorture access to sched_setaffinity(). */
long rcutorture_sched_setaffinity(pid_t pid, const struct cpumask *in_mask) long torture_sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
{ {
int ret; int ret;
ret = sched_setaffinity(pid, in_mask); ret = sched_setaffinity(pid, in_mask);
WARN_ONCE(ret, "%s: sched_setaffinity() returned %d\n", __func__, ret); WARN_ONCE(ret, "%s: sched_setaffinity(%d) returned %d\n", __func__, pid, ret);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(rcutorture_sched_setaffinity); EXPORT_SYMBOL_GPL(torture_sched_setaffinity);
#endif #endif
#ifdef CONFIG_RCU_STALL_COMMON #ifdef CONFIG_RCU_STALL_COMMON