Skip to content

Commit 0cfecd7

Browse files
paulmckrcuFrederic Weisbecker
authored andcommitted
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>
1 parent 3853a72 commit 0cfecd7

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

include/linux/torture.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,15 @@ void _torture_stop_kthread(char *m, struct task_struct **tp);
121121
#define torture_stop_kthread(n, tp) \
122122
_torture_stop_kthread("Stopping " #n " task", &(tp))
123123

124+
/* Scheduler-related definitions. */
124125
#ifdef CONFIG_PREEMPTION
125126
#define torture_preempt_schedule() __preempt_schedule()
126127
#else
127128
#define torture_preempt_schedule() do { } while (0)
128129
#endif
129130

131+
#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)
132+
long torture_sched_setaffinity(pid_t pid, const struct cpumask *in_mask);
133+
#endif
134+
130135
#endif /* __LINUX_TORTURE_H */

kernel/rcu/rcu.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,10 +568,6 @@ void do_trace_rcu_torture_read(const char *rcutorturename,
568568
static inline void rcu_gp_set_torture_wait(int duration) { }
569569
#endif
570570

571-
#if IS_ENABLED(CONFIG_RCU_TORTURE_TEST) || IS_MODULE(CONFIG_RCU_TORTURE_TEST)
572-
long rcutorture_sched_setaffinity(pid_t pid, const struct cpumask *in_mask);
573-
#endif
574-
575571
#ifdef CONFIG_TINY_SRCU
576572

577573
static inline void srcutorture_get_gp_data(enum rcutorture_type test_type,

kernel/rcu/rcutorture.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ static void synchronize_rcu_trivial(void)
810810
int cpu;
811811

812812
for_each_online_cpu(cpu) {
813-
rcutorture_sched_setaffinity(current->pid, cpumask_of(cpu));
813+
torture_sched_setaffinity(current->pid, cpumask_of(cpu));
814814
WARN_ON_ONCE(raw_smp_processor_id() != cpu);
815815
}
816816
}

kernel/rcu/update.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -525,17 +525,17 @@ EXPORT_SYMBOL_GPL(do_trace_rcu_torture_read);
525525
do { } while (0)
526526
#endif
527527

528-
#if IS_ENABLED(CONFIG_RCU_TORTURE_TEST) || IS_MODULE(CONFIG_RCU_TORTURE_TEST)
528+
#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)
529529
/* Get rcutorture access to sched_setaffinity(). */
530-
long rcutorture_sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
530+
long torture_sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
531531
{
532532
int ret;
533533

534534
ret = sched_setaffinity(pid, in_mask);
535-
WARN_ONCE(ret, "%s: sched_setaffinity() returned %d\n", __func__, ret);
535+
WARN_ONCE(ret, "%s: sched_setaffinity(%d) returned %d\n", __func__, pid, ret);
536536
return ret;
537537
}
538-
EXPORT_SYMBOL_GPL(rcutorture_sched_setaffinity);
538+
EXPORT_SYMBOL_GPL(torture_sched_setaffinity);
539539
#endif
540540

541541
#ifdef CONFIG_RCU_STALL_COMMON

0 commit comments

Comments
 (0)