Re: [PATCH v10 2/3] tracepoint: Make rcuidle tracepoint callers use SRCU

From: Joel Fernandes
Date: Tue Jul 17 2018 - 20:16:29 EST


On Tue, Jul 17, 2018 at 08:25:28PM +0200, Peter Zijlstra wrote:
> On Fri, Jul 13, 2018 at 02:55:46PM -0700, Joel Fernandes wrote:
> > + /* keep srcu and sched-rcu usage consistent */ \
> > + preempt_disable_notrace(); \
> > + \
> > + /* \
> > + * For rcuidle callers, use srcu since sched-rcu \
> > + * doesn't work from the idle path. \
> > + */ \
> > + if (rcuidle) \
> > + idx = srcu_read_lock_notrace(&tracepoint_srcu); \
> > + else \
> > + rcu_read_lock_sched_notrace(); \
>
> That else is completely superfluous. rcu_read_lock_sched_notrace() :=
> prempt_disable_notrace().

I have a patch as below on top of this series. Thanks for the suggestion.

Steve, Peter,

Is it Ok with you to take the below patch ontop of this series? I avoided
resending the 3-patch series since this is the only change, but let me know
what you prefer or makes it easy for you.

------->8--------

From: Joel Fernandes <joelaf@xxxxxxxxxx>
Subject: [PATCH] tracepoint: Remove extra unneeded rcu_read_lock_sched_notrace

A great idea was provided that rcu_read_lock_sched_notrace being the
equivalent of preempt_disable_notrace is unnecessary to call in
tracepoint code, since we already call preempt_disable_notrace in
advance. So lets remove the extra call.

Suggested-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Signed-off-by: Joel Fernandes <joelaf@xxxxxxxxxx>
---
include/linux/tracepoint.h | 4 ----
1 file changed, 4 deletions(-)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 97e1d365a817..6e7bc6ebfcd8 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -161,8 +161,6 @@ extern void syscall_unregfunc(void);
*/ \
if (rcuidle) \
idx = srcu_read_lock_notrace(&tracepoint_srcu); \
- else \
- rcu_read_lock_sched_notrace(); \
\
it_func_ptr = rcu_dereference_raw((tp)->funcs); \
\
@@ -176,8 +174,6 @@ extern void syscall_unregfunc(void);
\
if (rcuidle) \
srcu_read_unlock_notrace(&tracepoint_srcu, idx);\
- else \
- rcu_read_unlock_sched_notrace(); \
\
preempt_enable_notrace(); \
} while (0)
--
2.18.0.203.gfac676dfb9-goog