aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/file.c2
-rw-r--r--include/linux/rcupdate.h13
-rw-r--r--kernel/rcu/rcutorture.c4
-rw-r--r--kernel/rcu/tree.c12
-rw-r--r--kernel/rcu/tree_plugin.h2
-rw-r--r--mm/mlock.c2
6 files changed, 24 insertions, 11 deletions
diff --git a/fs/file.c b/fs/file.c
index 66923fe3176e..1cafc4c9275b 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -367,7 +367,7 @@ static struct fdtable *close_files(struct files_struct * files)
367 struct file * file = xchg(&fdt->fd[i], NULL); 367 struct file * file = xchg(&fdt->fd[i], NULL);
368 if (file) { 368 if (file) {
369 filp_close(file, files); 369 filp_close(file, files);
370 cond_resched(); 370 cond_resched_rcu_qs();
371 } 371 }
372 } 372 }
373 i++; 373 i++;
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 3432063f4c87..473350462d04 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -330,6 +330,19 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
330#define rcu_note_voluntary_context_switch(t) do { } while (0) 330#define rcu_note_voluntary_context_switch(t) do { } while (0)
331#endif /* #else #ifdef CONFIG_TASKS_RCU */ 331#endif /* #else #ifdef CONFIG_TASKS_RCU */
332 332
333/**
334 * cond_resched_rcu_qs - Report potential quiescent states to RCU
335 *
336 * This macro resembles cond_resched(), except that it is defined to
337 * report potential quiescent states to RCU-tasks even if the cond_resched()
338 * machinery were to be shut off, as some advocate for PREEMPT kernels.
339 */
340#define cond_resched_rcu_qs() \
341do { \
342 rcu_note_voluntary_context_switch(current); \
343 cond_resched(); \
344} while (0)
345
333#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) 346#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP)
334bool __rcu_is_watching(void); 347bool __rcu_is_watching(void);
335#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */ 348#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 948a7693748e..178716713e11 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -667,7 +667,7 @@ static int rcu_torture_boost(void *arg)
667 } 667 }
668 call_rcu_time = jiffies; 668 call_rcu_time = jiffies;
669 } 669 }
670 cond_resched(); 670 cond_resched_rcu_qs();
671 stutter_wait("rcu_torture_boost"); 671 stutter_wait("rcu_torture_boost");
672 if (torture_must_stop()) 672 if (torture_must_stop())
673 goto checkwait; 673 goto checkwait;
@@ -1019,7 +1019,7 @@ rcu_torture_reader(void *arg)
1019 __this_cpu_inc(rcu_torture_batch[completed]); 1019 __this_cpu_inc(rcu_torture_batch[completed]);
1020 preempt_enable(); 1020 preempt_enable();
1021 cur_ops->readunlock(idx); 1021 cur_ops->readunlock(idx);
1022 cond_resched(); 1022 cond_resched_rcu_qs();
1023 stutter_wait("rcu_torture_reader"); 1023 stutter_wait("rcu_torture_reader");
1024 } while (!torture_must_stop()); 1024 } while (!torture_must_stop());
1025 if (irqreader && cur_ops->irq_capable) { 1025 if (irqreader && cur_ops->irq_capable) {
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 8ad91d1e317d..e23dad0661e2 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -1647,7 +1647,7 @@ static int rcu_gp_init(struct rcu_state *rsp)
1647 rnp->level, rnp->grplo, 1647 rnp->level, rnp->grplo,
1648 rnp->grphi, rnp->qsmask); 1648 rnp->grphi, rnp->qsmask);
1649 raw_spin_unlock_irq(&rnp->lock); 1649 raw_spin_unlock_irq(&rnp->lock);
1650 cond_resched(); 1650 cond_resched_rcu_qs();
1651 } 1651 }
1652 1652
1653 mutex_unlock(&rsp->onoff_mutex); 1653 mutex_unlock(&rsp->onoff_mutex);
@@ -1736,7 +1736,7 @@ static void rcu_gp_cleanup(struct rcu_state *rsp)
1736 /* smp_mb() provided by prior unlock-lock pair. */ 1736 /* smp_mb() provided by prior unlock-lock pair. */
1737 nocb += rcu_future_gp_cleanup(rsp, rnp); 1737 nocb += rcu_future_gp_cleanup(rsp, rnp);
1738 raw_spin_unlock_irq(&rnp->lock); 1738 raw_spin_unlock_irq(&rnp->lock);
1739 cond_resched(); 1739 cond_resched_rcu_qs();
1740 } 1740 }
1741 rnp = rcu_get_root(rsp); 1741 rnp = rcu_get_root(rsp);
1742 raw_spin_lock_irq(&rnp->lock); 1742 raw_spin_lock_irq(&rnp->lock);
@@ -1785,7 +1785,7 @@ static int __noreturn rcu_gp_kthread(void *arg)
1785 /* Locking provides needed memory barrier. */ 1785 /* Locking provides needed memory barrier. */
1786 if (rcu_gp_init(rsp)) 1786 if (rcu_gp_init(rsp))
1787 break; 1787 break;
1788 cond_resched(); 1788 cond_resched_rcu_qs();
1789 flush_signals(current); 1789 flush_signals(current);
1790 trace_rcu_grace_period(rsp->name, 1790 trace_rcu_grace_period(rsp->name,
1791 ACCESS_ONCE(rsp->gpnum), 1791 ACCESS_ONCE(rsp->gpnum),
@@ -1828,10 +1828,10 @@ static int __noreturn rcu_gp_kthread(void *arg)
1828 trace_rcu_grace_period(rsp->name, 1828 trace_rcu_grace_period(rsp->name,
1829 ACCESS_ONCE(rsp->gpnum), 1829 ACCESS_ONCE(rsp->gpnum),
1830 TPS("fqsend")); 1830 TPS("fqsend"));
1831 cond_resched(); 1831 cond_resched_rcu_qs();
1832 } else { 1832 } else {
1833 /* Deal with stray signal. */ 1833 /* Deal with stray signal. */
1834 cond_resched(); 1834 cond_resched_rcu_qs();
1835 flush_signals(current); 1835 flush_signals(current);
1836 trace_rcu_grace_period(rsp->name, 1836 trace_rcu_grace_period(rsp->name,
1837 ACCESS_ONCE(rsp->gpnum), 1837 ACCESS_ONCE(rsp->gpnum),
@@ -2434,7 +2434,7 @@ static void force_qs_rnp(struct rcu_state *rsp,
2434 struct rcu_node *rnp; 2434 struct rcu_node *rnp;
2435 2435
2436 rcu_for_each_leaf_node(rsp, rnp) { 2436 rcu_for_each_leaf_node(rsp, rnp) {
2437 cond_resched(); 2437 cond_resched_rcu_qs();
2438 mask = 0; 2438 mask = 0;
2439 raw_spin_lock_irqsave(&rnp->lock, flags); 2439 raw_spin_lock_irqsave(&rnp->lock, flags);
2440 smp_mb__after_unlock_lock(); 2440 smp_mb__after_unlock_lock();
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index a7997e272564..7672586d3920 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -1848,7 +1848,7 @@ static int rcu_oom_notify(struct notifier_block *self,
1848 get_online_cpus(); 1848 get_online_cpus();
1849 for_each_online_cpu(cpu) { 1849 for_each_online_cpu(cpu) {
1850 smp_call_function_single(cpu, rcu_oom_notify_cpu, NULL, 1); 1850 smp_call_function_single(cpu, rcu_oom_notify_cpu, NULL, 1);
1851 cond_resched(); 1851 cond_resched_rcu_qs();
1852 } 1852 }
1853 put_online_cpus(); 1853 put_online_cpus();
1854 1854
diff --git a/mm/mlock.c b/mm/mlock.c
index ce84cb0b83ef..ab3150c26711 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -789,7 +789,7 @@ static int do_mlockall(int flags)
789 789
790 /* Ignore errors */ 790 /* Ignore errors */
791 mlock_fixup(vma, &prev, vma->vm_start, vma->vm_end, newflags); 791 mlock_fixup(vma, &prev, vma->vm_start, vma->vm_end, newflags);
792 cond_resched(); 792 cond_resched_rcu_qs();
793 } 793 }
794out: 794out:
795 return 0; 795 return 0;