History

rcu: Clean up after the SRCU-fastification of RCU Tasks Trace

Now that RCU Tasks Trace has been re-implemented in terms of SRCU-fast, the ->trc_ipi_to_cpu, ->trc_blkd_cpu, ->trc_blkd_node, ->trc_holdout_list, and ->trc_reader_special task_struct fields are no longer used. In addition, the rcu_tasks_trace_qs(), rcu_tasks_trace_qs_blkd(), exit_tasks_rcu_finish_trace(), and rcu_spawn_tasks_trace_kthread(), show_rcu_tasks_trace_gp_kthread(), rcu_tasks_trace_get_gp_data(), rcu_tasks_trace_torture_stats_print(), and get_rcu_tasks_trace_gp_kthread() functions and all the other functions that they invoke are no longer used. Also, the TRC_NEED_QS and TRC_NEED_QS_CHECKED CPP macros are no longer used. Neither are the rcu_tasks_trace_lazy_ms and rcu_task_ipi_delay rcupdate module parameters and the TASKS_TRACE_RCU_READ_MB Kconfig option. This commit therefore removes all of them. [ paulmck: Apply Alexei Starovoitov feedback. ]

Paul E. McKenney committed 10 months ago

Commit a73fc3d1 parent 46e323513 files · +2 −174Browse files

Unified · Split

13 files
  1. Documentation/admin-guide/kernel-parameters.txt +0 −15
  2. include/linux/rcupdate.h +1 −30
  3. include/linux/rcupdate_trace.h +0 −2
  4. include/linux/sched.h +0 −5
  5. init/init_task.c +0 −3
  6. kernel/fork.c +0 −3
  7. kernel/rcu/Kconfig +0 −18
  8. kernel/rcu/rcu.h +0 −9
  9. kernel/rcu/rcuscale.c +0 −7
  10. kernel/rcu/rcutorture.c +0 −2
  11. kernel/rcu/tasks.h +1 −78
  12. tools/testing/selftests/rcutorture/configs/rcu/TRACE01 +0 −1
  13. tools/testing/selftests/rcutorture/configs/rcu/TRACE02 +0 −1
Documentation/admin-guide/kernel-parameters.txt+0−15
@@ -6249,13 +6249,6 @@ Kernel parameters · 6248 unmodified lines
6249 dynamically) adjusted. This parameter is intended6249 dynamically) adjusted. This parameter is intended
6250 for use in testing.6250 for use in testing.
6251 6251
6252 rcupdate.rcu_task_ipi_delay= [KNL]
6253 Set time in jiffies during which RCU tasks will
6254 avoid sending IPIs, starting with the beginning
6255 of a given grace period. Setting a large
6256 number avoids disturbing real-time workloads,
6257 but lengthens grace periods.
6258
6259 rcupdate.rcu_task_lazy_lim= [KNL]6252 rcupdate.rcu_task_lazy_lim= [KNL]
6260 Number of callbacks on a given CPU that will6253 Number of callbacks on a given CPU that will
6261 cancel laziness on that CPU. Use -1 to disable6254 cancel laziness on that CPU. Use -1 to disable
@@ -6299,14 +6292,6 @@ Kernel parameters · 37 unmodified lines
6299 of zero will disable batching. Batching is6292 of zero will disable batching. Batching is
6300 always disabled for synchronize_rcu_tasks().6293 always disabled for synchronize_rcu_tasks().
6301 6294
6302 rcupdate.rcu_tasks_trace_lazy_ms= [KNL]
6303 Set timeout in milliseconds RCU Tasks
6304 Trace asynchronous callback batching for
6305 call_rcu_tasks_trace(). A negative value
6306 will take the default. A value of zero will
6307 disable batching. Batching is always disabled
6308 for synchronize_rcu_tasks_trace().
6309
6310 rcupdate.rcu_self_test= [KNL]6295 rcupdate.rcu_self_test= [KNL]
6311 Run the RCU early boot self tests6296 Run the RCU early boot self tests
6312 6297
include/linux/rcupdate.h+1−30
@@ -175,36 +175,7 @@ void rcu_tasks_torture_stats_print(char *tt, char *tf); · 174 unmodified lines
175# define synchronize_rcu_tasks synchronize_rcu175# define synchronize_rcu_tasks synchronize_rcu
176# endif176# endif
177 177
178# ifdef CONFIG_TASKS_TRACE_RCU178#define rcu_tasks_qs(t, preempt) rcu_tasks_classic_qs((t), (preempt))
179// Bits for ->trc_reader_special.b.need_qs field.
180#define TRC_NEED_QS 0x1 // Task needs a quiescent state.
181#define TRC_NEED_QS_CHECKED 0x2 // Task has been checked for needing quiescent state.
182
183u8 rcu_trc_cmpxchg_need_qs(struct task_struct *t, u8 old, u8 new);
184void rcu_tasks_trace_qs_blkd(struct task_struct *t);
185
186# define rcu_tasks_trace_qs(t) \
187 do { \
188 int ___rttq_nesting = READ_ONCE((t)->trc_reader_nesting); \
189 \
190 if (unlikely(READ_ONCE((t)->trc_reader_special.b.need_qs) == TRC_NEED_QS) && \
191 likely(!___rttq_nesting)) { \
192 rcu_trc_cmpxchg_need_qs((t), TRC_NEED_QS, TRC_NEED_QS_CHECKED); \
193 } else if (___rttq_nesting && ___rttq_nesting != INT_MIN && \
194 !READ_ONCE((t)->trc_reader_special.b.blocked)) { \
195 rcu_tasks_trace_qs_blkd(t); \
196 } \
197 } while (0)
198void rcu_tasks_trace_torture_stats_print(char *tt, char *tf);
199# else
200# define rcu_tasks_trace_qs(t) do { } while (0)
201# endif
202
203#define rcu_tasks_qs(t, preempt) \
204do { \
205 rcu_tasks_classic_qs((t), (preempt)); \
206 rcu_tasks_trace_qs(t); \
207} while (0)
208 179
209# ifdef CONFIG_TASKS_RUDE_RCU180# ifdef CONFIG_TASKS_RUDE_RCU
210void synchronize_rcu_tasks_rude(void);181void synchronize_rcu_tasks_rude(void);
include/linux/rcupdate_trace.h+0−2
@@ -136,9 +136,7 @@ static inline void rcu_barrier_tasks_trace(void) · 135 unmodified lines
136}136}
137 137
138// Placeholders to enable stepwise transition.138// Placeholders to enable stepwise transition.
139void rcu_tasks_trace_get_gp_data(int *flags, unsigned long *gp_seq);
140void __init rcu_tasks_trace_suppress_unused(void);139void __init rcu_tasks_trace_suppress_unused(void);
141struct task_struct *get_rcu_tasks_trace_gp_kthread(void);
142 140
143#else141#else
144/*142/*
include/linux/sched.h+0−5
@@ -946,11 +946,6 @@ struct task_struct { · 945 unmodified lines
946#ifdef CONFIG_TASKS_TRACE_RCU946#ifdef CONFIG_TASKS_TRACE_RCU
947 int trc_reader_nesting;947 int trc_reader_nesting;
948 struct srcu_ctr __percpu *trc_reader_scp;948 struct srcu_ctr __percpu *trc_reader_scp;
949 int trc_ipi_to_cpu;
950 union rcu_special trc_reader_special;
951 struct list_head trc_holdout_list;
952 struct list_head trc_blkd_node;
953 int trc_blkd_cpu;
954#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */949#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */
955 950
956 struct sched_info sched_info;951 struct sched_info sched_info;
init/init_task.c+0−3
@@ -195,9 +195,6 @@ struct task_struct init_task __aligned(L1_CACHE_BYTES) = { · 194 unmodified lines
195#endif195#endif
196#ifdef CONFIG_TASKS_TRACE_RCU196#ifdef CONFIG_TASKS_TRACE_RCU
197 .trc_reader_nesting = 0,197 .trc_reader_nesting = 0,
198 .trc_reader_special.s = 0,
199 .trc_holdout_list = LIST_HEAD_INIT(init_task.trc_holdout_list),
200 .trc_blkd_node = LIST_HEAD_INIT(init_task.trc_blkd_node),
201#endif198#endif
202#ifdef CONFIG_CPUSETS199#ifdef CONFIG_CPUSETS
203 .mems_allowed_seq = SEQCNT_SPINLOCK_ZERO(init_task.mems_allowed_seq,200 .mems_allowed_seq = SEQCNT_SPINLOCK_ZERO(init_task.mems_allowed_seq,
kernel/fork.c+0−3
@@ -1828,9 +1828,6 @@ static inline void rcu_copy_process(struct task_struct *p) · 1827 unmodified lines
1828#endif /* #ifdef CONFIG_TASKS_RCU */1828#endif /* #ifdef CONFIG_TASKS_RCU */
1829#ifdef CONFIG_TASKS_TRACE_RCU1829#ifdef CONFIG_TASKS_TRACE_RCU
1830 p->trc_reader_nesting = 0;1830 p->trc_reader_nesting = 0;
1831 p->trc_reader_special.s = 0;
1832 INIT_LIST_HEAD(&p->trc_holdout_list);
1833 INIT_LIST_HEAD(&p->trc_blkd_node);
1834#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */1831#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */
1835}1832}
1836 1833
kernel/rcu/Kconfig+0−18
@@ -313,24 +313,6 @@ config RCU_NOCB_CPU_CB_BOOST · 312 unmodified lines
313 Say Y here if you want to set RT priority for offloading kthreads.313 Say Y here if you want to set RT priority for offloading kthreads.
314 Say N here if you are building a !PREEMPT_RT kernel and are unsure.314 Say N here if you are building a !PREEMPT_RT kernel and are unsure.
315 315
316config TASKS_TRACE_RCU_READ_MB
317 bool "Tasks Trace RCU readers use memory barriers in user and idle"
318 depends on RCU_EXPERT && TASKS_TRACE_RCU
319 default PREEMPT_RT || NR_CPUS < 8
320 help
321 Use this option to further reduce the number of IPIs sent
322 to CPUs executing in userspace or idle during tasks trace
323 RCU grace periods. Given that a reasonable setting of
324 the rcupdate.rcu_task_ipi_delay kernel boot parameter
325 eliminates such IPIs for many workloads, proper setting
326 of this Kconfig option is important mostly for aggressive
327 real-time installations and for battery-powered devices,
328 hence the default chosen above.
329
330 Say Y here if you hate IPIs.
331 Say N here if you hate read-side memory barriers.
332 Take the default if you are unsure.
333
334config RCU_LAZY316config RCU_LAZY
335 bool "RCU callback lazy invocation functionality"317 bool "RCU callback lazy invocation functionality"
336 depends on RCU_NOCB_CPU318 depends on RCU_NOCB_CPU
kernel/rcu/rcu.h+0−9
@@ -544,10 +544,6 @@ struct task_struct *get_rcu_tasks_rude_gp_kthread(void); · 543 unmodified lines
544void rcu_tasks_rude_get_gp_data(int *flags, unsigned long *gp_seq);544void rcu_tasks_rude_get_gp_data(int *flags, unsigned long *gp_seq);
545#endif // # ifdef CONFIG_TASKS_RUDE_RCU545#endif // # ifdef CONFIG_TASKS_RUDE_RCU
546 546
547#ifdef CONFIG_TASKS_TRACE_RCU
548void rcu_tasks_trace_get_gp_data(int *flags, unsigned long *gp_seq);
549#endif
550
551#ifdef CONFIG_TASKS_RCU_GENERIC547#ifdef CONFIG_TASKS_RCU_GENERIC
552void tasks_cblist_init_generic(void);548void tasks_cblist_init_generic(void);
553#else /* #ifdef CONFIG_TASKS_RCU_GENERIC */549#else /* #ifdef CONFIG_TASKS_RCU_GENERIC */
@@ -673,11 +669,6 @@ void show_rcu_tasks_rude_gp_kthread(void); · 119 unmodified lines
673#else669#else
674static inline void show_rcu_tasks_rude_gp_kthread(void) {}670static inline void show_rcu_tasks_rude_gp_kthread(void) {}
675#endif671#endif
676#if !defined(CONFIG_TINY_RCU) && defined(CONFIG_TASKS_TRACE_RCU)
677void show_rcu_tasks_trace_gp_kthread(void);
678#else
679static inline void show_rcu_tasks_trace_gp_kthread(void) {}
680#endif
681 672
682#ifdef CONFIG_TINY_RCU673#ifdef CONFIG_TINY_RCU
683static inline bool rcu_cpu_beenfullyonline(int cpu) { return true; }674static inline bool rcu_cpu_beenfullyonline(int cpu) { return true; }
kernel/rcu/rcuscale.c+0−7
@@ -400,11 +400,6 @@ static void tasks_trace_scale_read_unlock(int idx) · 399 unmodified lines
400 rcu_read_unlock_trace();400 rcu_read_unlock_trace();
401}401}
402 402
403static void rcu_tasks_trace_scale_stats(void)
404{
405 rcu_tasks_trace_torture_stats_print(scale_type, SCALE_FLAG);
406}
407
408static struct rcu_scale_ops tasks_tracing_ops = {403static struct rcu_scale_ops tasks_tracing_ops = {
409 .ptype = RCU_TASKS_FLAVOR,404 .ptype = RCU_TASKS_FLAVOR,
410 .init = rcu_sync_scale_init,405 .init = rcu_sync_scale_init,
@@ -416,8 +411,6 @@ static struct rcu_scale_ops tasks_tracing_ops = { · 5 unmodified lines
416 .gp_barrier = rcu_barrier_tasks_trace,411 .gp_barrier = rcu_barrier_tasks_trace,
417 .sync = synchronize_rcu_tasks_trace,412 .sync = synchronize_rcu_tasks_trace,
418 .exp_sync = synchronize_rcu_tasks_trace,413 .exp_sync = synchronize_rcu_tasks_trace,
419 .rso_gp_kthread = get_rcu_tasks_trace_gp_kthread,
420 .stats = IS_ENABLED(CONFIG_TINY_RCU) ? NULL : rcu_tasks_trace_scale_stats,
421 .name = "tasks-tracing"414 .name = "tasks-tracing"
422};415};
423 416
kernel/rcu/rcutorture.c+0−2
@@ -1180,8 +1180,6 @@ static struct rcu_torture_ops tasks_tracing_ops = { · 1179 unmodified lines
1180 .exp_sync = synchronize_rcu_tasks_trace,1180 .exp_sync = synchronize_rcu_tasks_trace,
1181 .call = call_rcu_tasks_trace,1181 .call = call_rcu_tasks_trace,
1182 .cb_barrier = rcu_barrier_tasks_trace,1182 .cb_barrier = rcu_barrier_tasks_trace,
1183 .gp_kthread_dbg = show_rcu_tasks_trace_gp_kthread,
1184 .get_gp_data = rcu_tasks_trace_get_gp_data,
1185 .cbflood_max = 50000,1183 .cbflood_max = 50000,
1186 .irq_capable = 1,1184 .irq_capable = 1,
1187 .slow_gps = 1,1185 .slow_gps = 1,
kernel/rcu/tasks.h+1−78
@@ -161,11 +161,6 @@ static void tasks_rcu_exit_srcu_stall(struct timer_list *unused); · 160 unmodified lines
161static DEFINE_TIMER(tasks_rcu_exit_srcu_stall_timer, tasks_rcu_exit_srcu_stall);161static DEFINE_TIMER(tasks_rcu_exit_srcu_stall_timer, tasks_rcu_exit_srcu_stall);
162#endif162#endif
163 163
164/* Avoid IPIing CPUs early in the grace period. */
165#define RCU_TASK_IPI_DELAY (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB) ? HZ / 2 : 0)
166static int rcu_task_ipi_delay __read_mostly = RCU_TASK_IPI_DELAY;
167module_param(rcu_task_ipi_delay, int, 0644);
168
169/* Control stall timeouts. Disable with <= 0, otherwise jiffies till stall. */164/* Control stall timeouts. Disable with <= 0, otherwise jiffies till stall. */
170#define RCU_TASK_BOOT_STALL_TIMEOUT (HZ * 30)165#define RCU_TASK_BOOT_STALL_TIMEOUT (HZ * 30)
171#define RCU_TASK_STALL_TIMEOUT (HZ * 60 * 10)166#define RCU_TASK_STALL_TIMEOUT (HZ * 60 * 10)
@@ -800,8 +795,6 @@ static void rcu_tasks_torture_stats_print_generic(struct rcu_tasks *rtp, char *t · 628 unmodified lines
800 795
801#endif // #ifndef CONFIG_TINY_RCU796#endif // #ifndef CONFIG_TINY_RCU
802 797
803static void exit_tasks_rcu_finish_trace(struct task_struct *t);
804
805#if defined(CONFIG_TASKS_RCU)798#if defined(CONFIG_TASKS_RCU)
806 799
807////////////////////////////////////////////////////////////////////////800////////////////////////////////////////////////////////////////////////
@@ -1321,13 +1314,11 @@ void exit_tasks_rcu_finish(void) · 513 unmodified lines
1321 raw_spin_lock_irqsave_rcu_node(rtpcp, flags);1314 raw_spin_lock_irqsave_rcu_node(rtpcp, flags);
1322 list_del_init(&t->rcu_tasks_exit_list);1315 list_del_init(&t->rcu_tasks_exit_list);
1323 raw_spin_unlock_irqrestore_rcu_node(rtpcp, flags);1316 raw_spin_unlock_irqrestore_rcu_node(rtpcp, flags);
1324
1325 exit_tasks_rcu_finish_trace(t);
1326}1317}
1327 1318
1328#else /* #ifdef CONFIG_TASKS_RCU */1319#else /* #ifdef CONFIG_TASKS_RCU */
1329void exit_tasks_rcu_start(void) { }1320void exit_tasks_rcu_start(void) { }
1330void exit_tasks_rcu_finish(void) { exit_tasks_rcu_finish_trace(current); }1321void exit_tasks_rcu_finish(void) { }
1331#endif /* #else #ifdef CONFIG_TASKS_RCU */1322#endif /* #else #ifdef CONFIG_TASKS_RCU */
1332 1323
1333#ifdef CONFIG_TASKS_RUDE_RCU1324#ifdef CONFIG_TASKS_RUDE_RCU
@@ -1475,69 +1466,6 @@ void __init rcu_tasks_trace_suppress_unused(void) · 141 unmodified lines
1475#endif // #ifndef CONFIG_TINY_RCU1466#endif // #ifndef CONFIG_TINY_RCU
1476}1467}
1477 1468
1478/*
1479 * Do a cmpxchg() on ->trc_reader_special.b.need_qs, allowing for
1480 * the four-byte operand-size restriction of some platforms.
1481 *
1482 * Returns the old value, which is often ignored.
1483 */
1484u8 rcu_trc_cmpxchg_need_qs(struct task_struct *t, u8 old, u8 new)
1485{
1486 return cmpxchg(&t->trc_reader_special.b.need_qs, old, new);
1487}
1488EXPORT_SYMBOL_GPL(rcu_trc_cmpxchg_need_qs);
1489
1490/* Add a newly blocked reader task to its CPU's list. */
1491void rcu_tasks_trace_qs_blkd(struct task_struct *t)
1492{
1493}
1494EXPORT_SYMBOL_GPL(rcu_tasks_trace_qs_blkd);
1495
1496/* Communicate task state back to the RCU tasks trace stall warning request. */
1497struct trc_stall_chk_rdr {
1498 int nesting;
1499 int ipi_to_cpu;
1500 u8 needqs;
1501};
1502
1503/* Report any needed quiescent state for this exiting task. */
1504static void exit_tasks_rcu_finish_trace(struct task_struct *t)
1505{
1506}
1507
1508int rcu_tasks_trace_lazy_ms = -1;
1509module_param(rcu_tasks_trace_lazy_ms, int, 0444);
1510
1511static int __init rcu_spawn_tasks_trace_kthread(void)
1512{
1513 return 0;
1514}
1515
1516#if !defined(CONFIG_TINY_RCU)
1517void show_rcu_tasks_trace_gp_kthread(void)
1518{
1519}
1520EXPORT_SYMBOL_GPL(show_rcu_tasks_trace_gp_kthread);
1521
1522void rcu_tasks_trace_torture_stats_print(char *tt, char *tf)
1523{
1524}
1525EXPORT_SYMBOL_GPL(rcu_tasks_trace_torture_stats_print);
1526#endif // !defined(CONFIG_TINY_RCU)
1527
1528struct task_struct *get_rcu_tasks_trace_gp_kthread(void)
1529{
1530 return NULL;
1531}
1532EXPORT_SYMBOL_GPL(get_rcu_tasks_trace_gp_kthread);
1533
1534void rcu_tasks_trace_get_gp_data(int *flags, unsigned long *gp_seq)
1535{
1536}
1537EXPORT_SYMBOL_GPL(rcu_tasks_trace_get_gp_data);
1538
1539#else /* #ifdef CONFIG_TASKS_TRACE_RCU */
1540static void exit_tasks_rcu_finish_trace(struct task_struct *t) { }
1541#endif /* #else #ifdef CONFIG_TASKS_TRACE_RCU */1469#endif /* #else #ifdef CONFIG_TASKS_TRACE_RCU */
1542 1470
1543#ifndef CONFIG_TINY_RCU1471#ifndef CONFIG_TINY_RCU
@@ -1545,7 +1473,6 @@ void show_rcu_tasks_gp_kthreads(void) · 1 unmodified line
1545{1473{
1546 show_rcu_tasks_classic_gp_kthread();1474 show_rcu_tasks_classic_gp_kthread();
1547 show_rcu_tasks_rude_gp_kthread();1475 show_rcu_tasks_rude_gp_kthread();
1548 show_rcu_tasks_trace_gp_kthread();
1549}1476}
1550#endif /* #ifndef CONFIG_TINY_RCU */1477#endif /* #ifndef CONFIG_TINY_RCU */
1551 1478
@@ -1684,10 +1611,6 @@ static int __init rcu_init_tasks_generic(void) · 132 unmodified lines
1684 rcu_spawn_tasks_rude_kthread();1611 rcu_spawn_tasks_rude_kthread();
1685#endif1612#endif
1686 1613
1687#ifdef CONFIG_TASKS_TRACE_RCU
1688 rcu_spawn_tasks_trace_kthread();
1689#endif
1690
1691 // Run the self-tests.1614 // Run the self-tests.
1692 rcu_tasks_initiate_self_tests();1615 rcu_tasks_initiate_self_tests();
1693 1616
tools/testing/selftests/rcutorture/configs/rcu/TRACE01+0−1
@@ -10,5 +10,4 @@ CONFIG_PROVE_LOCKING=n · 9 unmodified lines
10#CHECK#CONFIG_PROVE_RCU=n10#CHECK#CONFIG_PROVE_RCU=n
11CONFIG_FORCE_TASKS_TRACE_RCU=y11CONFIG_FORCE_TASKS_TRACE_RCU=y
12#CHECK#CONFIG_TASKS_TRACE_RCU=y12#CHECK#CONFIG_TASKS_TRACE_RCU=y
13CONFIG_TASKS_TRACE_RCU_READ_MB=y
14CONFIG_RCU_EXPERT=y13CONFIG_RCU_EXPERT=y
tools/testing/selftests/rcutorture/configs/rcu/TRACE02+0−1
@@ -9,6 +9,5 @@ CONFIG_PROVE_LOCKING=y · 8 unmodified lines
9#CHECK#CONFIG_PROVE_RCU=y9#CHECK#CONFIG_PROVE_RCU=y
10CONFIG_FORCE_TASKS_TRACE_RCU=y10CONFIG_FORCE_TASKS_TRACE_RCU=y
11#CHECK#CONFIG_TASKS_TRACE_RCU=y11#CHECK#CONFIG_TASKS_TRACE_RCU=y
12CONFIG_TASKS_TRACE_RCU_READ_MB=n
13CONFIG_RCU_EXPERT=y12CONFIG_RCU_EXPERT=y
14CONFIG_DEBUG_OBJECTS=y13CONFIG_DEBUG_OBJECTS=y

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t