Skip to contentSkip to conversation

RCU preempt updates

PATCH Applied Steven Rostedt 3 participants 7 messages Jul 30, 2008 – Aug 15, 2008 RCU

lore
Share & tools
lore

Steven Rostedt

author reviewer
#0 lore raw

cover RCU preempt updates

The following patches have been sitting in the RT tree for some time. They have been waiting for both RCU preempt and RCU preempt tracing to get into mainline.

Since those are now in mainline, it is time to send in these patches.

-- Steve

author reviewer
#1 lore raw

PATCH 1/2 rcu: just rename call_rcu_bh instead of making it a macro

Seems that I found a box that has a config that passes call_rcu_bh as a function pointer (see net/sctp/sm_make_chunk.c), so declaring the call_rcu_bh has a macro function isn't good enough.

This patch makes it just another name of call_rcu for rcupreempt.

---
 include/linux/rcupreempt.h |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
include/linux/rcupreempt.h +7 -1
Index: linux-compile.git/include/linux/rcupreempt.h
===================================================================
@@ -57,7 +57,13 @@ static inline void rcu_qsctr_inc(int cpu
 	rdssp->sched_qs++;
 }
 #define rcu_bh_qsctr_inc(cpu)
-#define call_rcu_bh(head, rcu) call_rcu(head, rcu)
+
+/*
+ * Someone might want to pass call_rcu_bh as a function pointer.
+ * So this needs to just be a rename and not a macro function.
+ *  (no parentheses)
+ */
+#define call_rcu_bh	 	call_rcu
 
 /**
  * call_rcu_sched - Queue RCU callback for invocation after sched grace period.
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] rcu: just rename call_rcu_bh instead of making it a macro

Quoted 5 lines · Steven Rostedt

Seems that I found a box that has a config that passes call_rcu_bh as a function pointer (see net/sctp/sm_make_chunk.c), so declaring the call_rcu_bh has a macro function isn't good enough.

This patch makes it just another name of call_rcu for rcupreempt.

Looks good!

Quoted 27 lines
---
 include/linux/rcupreempt.h |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Index: linux-compile.git/include/linux/rcupreempt.h
===================================================================

include/linux/rcupreempt.h +7 -1
@@ -57,7 +57,13 @@ static inline void rcu_qsctr_inc(int cpu
 	rdssp->sched_qs++;
 }
 #define rcu_bh_qsctr_inc(cpu)
-#define call_rcu_bh(head, rcu) call_rcu(head, rcu)
+
+/*
+ * Someone might want to pass call_rcu_bh as a function pointer.
+ * So this needs to just be a rename and not a macro function.
+ *  (no parentheses)
+ */
+#define call_rcu_bh	 	call_rcu
 
 /**
  * call_rcu_sched - Queue RCU callback for invocation after sched grace period.
Signature · 1 line
-- 
Applied
#3 lore raw

Re: [PATCH 1/2] rcu: just rename call_rcu_bh instead of making it a macro

Quoted 10 lines · Paul E. McKenney
Quoted 5 lines · Steven Rostedt

Seems that I found a box that has a config that passes call_rcu_bh as a function pointer (see net/sctp/sm_make_chunk.c), so declaring the call_rcu_bh has a macro function isn't good enough.

This patch makes it just another name of call_rcu for rcupreempt.

Looks good!

applied to tip/core/rcu - thanks!

Ingo

author reviewer
#4 lore raw

PATCH 2/2 rcu: trace fix possible mem-leak

In reply to Steven Rostedt

In the initialization of the RCU trace module, if rcupreempt_debugfs_init() fails, we never free the the trace buffer.

This patch frees the trace buffer in case the debugfs fails.

---
 kernel/rcupreempt_trace.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/rcupreempt_trace.c +6 -1
Index: linux-compile.git/kernel/rcupreempt_trace.c
===================================================================
@@ -308,11 +308,16 @@ out:
 
 static int __init rcupreempt_trace_init(void)
 {
+	int ret;
+
 	mutex_init(&rcupreempt_trace_mutex);
 	rcupreempt_trace_buf = kmalloc(RCUPREEMPT_TRACE_BUF_SIZE, GFP_KERNEL);
 	if (!rcupreempt_trace_buf)
 		return 1;
-	return rcupreempt_debugfs_init();
+	ret = rcupreempt_debugfs_init();
+	if (ret)
+		kfree(rcupreempt_trace_buf);
+	return ret;
 }
 
 static void __exit rcupreempt_trace_cleanup(void)
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] rcu: trace fix possible mem-leak

Quoted 4 lines · Steven Rostedt

In the initialization of the RCU trace module, if rcupreempt_debugfs_init() fails, we never free the the trace buffer.

This patch frees the trace buffer in case the debugfs fails.

Looks good as well!

Quoted 29 lines
---
 kernel/rcupreempt_trace.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Index: linux-compile.git/kernel/rcupreempt_trace.c
===================================================================

kernel/rcupreempt_trace.c +6 -1
@@ -308,11 +308,16 @@ out:
 
 static int __init rcupreempt_trace_init(void)
 {
+	int ret;
+
 	mutex_init(&rcupreempt_trace_mutex);
 	rcupreempt_trace_buf = kmalloc(RCUPREEMPT_TRACE_BUF_SIZE, GFP_KERNEL);
 	if (!rcupreempt_trace_buf)
 		return 1;
-	return rcupreempt_debugfs_init();
+	ret = rcupreempt_debugfs_init();
+	if (ret)
+		kfree(rcupreempt_trace_buf);
+	return ret;
 }
 
 static void __exit rcupreempt_trace_cleanup(void)
Signature · 1 line
-- 
Applied
#6 lore raw

Re: [PATCH 2/2] rcu: trace fix possible mem-leak

Quoted 9 lines · Paul E. McKenney
Quoted 4 lines · Steven Rostedt

In the initialization of the RCU trace module, if rcupreempt_debugfs_init() fails, we never free the the trace buffer.

This patch frees the trace buffer in case the debugfs fails.

Looks good as well!

applied to tip/core/rcu - thanks.

Ingo