···497498 Accept the default if unsure.499500-config SRCU_SYNCHRONIZE_DELAY501- int "Microseconds to delay before waiting for readers"502- range 0 20503- default 10504- help505- This option controls how long SRCU delays before entering its506- loop waiting on SRCU readers. The purpose of this loop is507- to avoid the unconditional context-switch penalty that would508- otherwise be incurred if there was an active SRCU reader,509- in a manner similar to adaptive locking schemes. This should510- be set to be a bit longer than the common-case SRCU read-side511- critical-section overhead.512-513- Accept the default if unsure.514-515endmenu # "RCU Subsystem"516517config IKCONFIG
···497498 Accept the default if unsure.499000000000000000500endmenu # "RCU Subsystem"501502config IKCONFIG
+2-1
kernel/rcutiny.c
···189 unsigned long flags;190191 for (;;) {192- wait_event(rcu_kthread_wq, have_rcu_kthread_work != 0);0193 morework = rcu_boost();194 local_irq_save(flags);195 work = have_rcu_kthread_work;
···189 unsigned long flags;190191 for (;;) {192+ wait_event_interruptible(rcu_kthread_wq,193+ have_rcu_kthread_work != 0);194 morework = rcu_boost();195 local_irq_save(flags);196 work = have_rcu_kthread_work;
+13-2
kernel/srcu.c
···156EXPORT_SYMBOL_GPL(__srcu_read_unlock);157158/*0000000000159 * Helper function for synchronize_srcu() and synchronize_srcu_expedited().160 */161static void __synchronize_srcu(struct srcu_struct *sp, void (*sync_func)(void))···217 * will have finished executing. We initially give readers218 * an arbitrarily chosen 10 microseconds to get out of their219 * SRCU read-side critical sections, then loop waiting 1/HZ220- * seconds per iteration.0221 */222223 if (srcu_readers_active_idx(sp, idx))224- udelay(CONFIG_SRCU_SYNCHRONIZE_DELAY);225 while (srcu_readers_active_idx(sp, idx))226 schedule_timeout_interruptible(1);227
···156EXPORT_SYMBOL_GPL(__srcu_read_unlock);157158/*159+ * We use an adaptive strategy for synchronize_srcu() and especially for160+ * synchronize_srcu_expedited(). We spin for a fixed time period161+ * (defined below) to allow SRCU readers to exit their read-side critical162+ * sections. If there are still some readers after 10 microseconds,163+ * we repeatedly block for 1-millisecond time periods. This approach164+ * has done well in testing, so there is no need for a config parameter.165+ */166+#define SYNCHRONIZE_SRCU_READER_DELAY 10167+168+/*169 * Helper function for synchronize_srcu() and synchronize_srcu_expedited().170 */171static void __synchronize_srcu(struct srcu_struct *sp, void (*sync_func)(void))···207 * will have finished executing. We initially give readers208 * an arbitrarily chosen 10 microseconds to get out of their209 * SRCU read-side critical sections, then loop waiting 1/HZ210+ * seconds per iteration. The 10-microsecond value has done211+ * very well in testing.212 */213214 if (srcu_readers_active_idx(sp, idx))215+ udelay(SYNCHRONIZE_SRCU_READER_DELAY);216 while (srcu_readers_active_idx(sp, idx))217 schedule_timeout_interruptible(1);218