[PATCH 3/4] jrcu: tap might_resched()

From: Joe Korty
Date: Wed Mar 09 2011 - 17:16:46 EST


jrcu: tap into might_resched.

All places where the voluntary preemption patches have marked
as safe to context switch are also known rcu quiescent points.

Not fundamentally needed, accelerates rcu batching.

Signed-off-by: Joe Korty <joe.korty@xxxxxxxx>

Index: b/include/linux/kernel.h
===================================================================
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -114,11 +114,18 @@ struct completion;
struct pt_regs;
struct user;

+/* cannot bring in linux/rcupdate.h at this point */
+#ifdef CONFIG_JRCU
+extern void rcu_note_might_resched(void);
+#else
+#define rcu_note_might_resched()
+#endif /*JRCU */
+
#ifdef CONFIG_PREEMPT_VOLUNTARY
extern int _cond_resched(void);
-# define might_resched() _cond_resched()
+# define might_resched() do { _cond_resched(); rcu_note_might_resched(); } while (0)
#else
-# define might_resched() do { } while (0)
+# define might_resched() do { rcu_note_might_resched(); } while (0)
#endif

#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
Index: b/include/linux/jrcu.h
===================================================================
--- a/include/linux/jrcu.h
+++ b/include/linux/jrcu.h
@@ -71,6 +71,8 @@ extern void rcu_note_context_switch(int
#define rcu_sched_qs rcu_note_context_switch
#define rcu_bh_qs rcu_note_context_switch

+extern void rcu_note_might_resched(void);
+
extern void rcu_scheduler_starting(void);
extern int rcu_scheduler_active __read_mostly;

Index: b/kernel/jrcu.c
===================================================================
--- a/kernel/jrcu.c
+++ b/kernel/jrcu.c
@@ -166,6 +166,16 @@ void rcu_note_context_switch(int cpu)
rcu_eob(cpu);
}

+void rcu_note_might_resched(void)
+{
+ unsigned long flags;
+
+ raw_local_irq_save(flags);
+ rcu_eob(rcu_cpu());
+ raw_local_irq_restore(flags);
+}
+EXPORT_SYMBOL(rcu_note_might_resched);
+
void rcu_barrier(void)
{
struct rcu_synchronize rcu;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/