Skip to contentSkip to conversation

RCU, kmemtrace: fix linux/rcutree.h and linux/rcuclassic.h dependencies

tip:tracing/kmemtrace Ingo Molnar 4 participants 21 messages Mar 25, 2009 – Apr 3, 2009 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1237898630.25315.83.camel@penberg-laptop

#1 lore raw
Commit-ID:  e03b679cfb1ef2270282525fc006be1b183a1e07
Gitweb:     http://git.kernel.org/tip/e03b679cfb1ef2270282525fc006be1b183a1e07
Author:     Ingo Molnar <[email protected]>
AuthorDate: Fri, 13 Mar 2009 03:20:49 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 25 Mar 2009 17:13:40 +0100

RCU, kmemtrace: fix linux/rcutree.h and linux/rcuclassic.h dependencies

Impact: build fix for all non-x86 architectures

The recent removal of percpu.h from rcuclassic.h/rcutree.h broke the DECLARE_PER_CPU declarations in these files.

Move the quiescent counter management functions to their respective RCU implementation .c files - they were slightly above the inlining limit anyway.

Cc: Pekka Enberg <[email protected]>
Cc: Eduard - Gabriel Munteanu <[email protected]>
Cc: [email protected]
LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

---
 include/linux/rcuclassic.h |   15 ++-------------
 include/linux/rcutree.h    |   26 ++------------------------
 kernel/rcuclassic.c        |   23 +++++++++++++++++++++--
 kernel/rcutree.c           |   28 ++++++++++++++++++++++++----
 4 files changed, 49 insertions(+), 43 deletions(-)
include/linux/rcuclassic.h +2 -13
index cc3f723..bfd92e1 100644
@@ -107,25 +107,14 @@ struct rcu_data {
 	struct rcu_head barrier;
 };
 
-DECLARE_PER_CPU(struct rcu_data, rcu_data);
-DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
-
 /*
  * Increment the quiescent state counter.
  * The counter is a bit degenerated: We do not need to know
  * how many quiescent states passed, just if there was at least
  * one since the start of the grace period. Thus just a flag.
  */
-static inline void rcu_qsctr_inc(int cpu)
-{
-	struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
-	rdp->passed_quiesc = 1;
-}
-static inline void rcu_bh_qsctr_inc(int cpu)
-{
-	struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
-	rdp->passed_quiesc = 1;
-}
+extern void rcu_qsctr_inc(int cpu);
+extern void rcu_bh_qsctr_inc(int cpu);
 
 extern int rcu_pending(int cpu);
 extern int rcu_needs_cpu(int cpu);
include/linux/rcutree.h +2 -24
index a26b4f1..0cdda00 100644
@@ -235,30 +235,8 @@ struct rcu_state {
 #endif /* #ifdef CONFIG_NO_HZ */
 };
 
-extern struct rcu_state rcu_state;
-DECLARE_PER_CPU(struct rcu_data, rcu_data);
-
-extern struct rcu_state rcu_bh_state;
-DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
-
-/*
- * Increment the quiescent state counter.
- * The counter is a bit degenerated: We do not need to know
- * how many quiescent states passed, just if there was at least
- * one since the start of the grace period. Thus just a flag.
- */
-static inline void rcu_qsctr_inc(int cpu)
-{
-	struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
-	rdp->passed_quiesc = 1;
-	rdp->passed_quiesc_completed = rdp->completed;
-}
-static inline void rcu_bh_qsctr_inc(int cpu)
-{
-	struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
-	rdp->passed_quiesc = 1;
-	rdp->passed_quiesc_completed = rdp->completed;
-}
+extern void rcu_qsctr_inc(int cpu);
+extern void rcu_bh_qsctr_inc(int cpu);
 
 extern int rcu_pending(int cpu);
 extern int rcu_needs_cpu(int cpu);
kernel/rcuclassic.c +21 -2
index 654c640..0f2b0b3 100644
@@ -65,6 +65,7 @@ static struct rcu_ctrlblk rcu_ctrlblk = {
 	.lock = __SPIN_LOCK_UNLOCKED(&rcu_ctrlblk.lock),
 	.cpumask = CPU_BITS_NONE,
 };
+
 static struct rcu_ctrlblk rcu_bh_ctrlblk = {
 	.cur = -300,
 	.completed = -300,
@@ -73,8 +74,26 @@ static struct rcu_ctrlblk rcu_bh_ctrlblk = {
 	.cpumask = CPU_BITS_NONE,
 };
 
-DEFINE_PER_CPU(struct rcu_data, rcu_data) = { 0L };
-DEFINE_PER_CPU(struct rcu_data, rcu_bh_data) = { 0L };
+static DEFINE_PER_CPU(struct rcu_data, rcu_data);
+static DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
+
+/*
+ * Increment the quiescent state counter.
+ * The counter is a bit degenerated: We do not need to know
+ * how many quiescent states passed, just if there was at least
+ * one since the start of the grace period. Thus just a flag.
+ */
+void rcu_qsctr_inc(int cpu)
+{
+	struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
+	rdp->passed_quiesc = 1;
+}
+
+void rcu_bh_qsctr_inc(int cpu)
+{
+	struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
+	rdp->passed_quiesc = 1;
+}
 
 static int blimit = 10;
 static int qhimark = 10000;
kernel/rcutree.c +24 -4
index 97ce315..a2015ed 100644
@@ -72,11 +72,31 @@ EXPORT_SYMBOL_GPL(rcu_lock_map);
 	.n_force_qs_ngp = 0, \
 }
 
-struct rcu_state rcu_state = RCU_STATE_INITIALIZER(rcu_state);
-DEFINE_PER_CPU(struct rcu_data, rcu_data);
+static struct rcu_state rcu_state = RCU_STATE_INITIALIZER(rcu_state);
+static DEFINE_PER_CPU(struct rcu_data, rcu_data);
 
-struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state);
-DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
+static struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state);
+static DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
+
+/*
+ * Increment the quiescent state counter.
+ * The counter is a bit degenerated: We do not need to know
+ * how many quiescent states passed, just if there was at least
+ * one since the start of the grace period. Thus just a flag.
+ */
+void rcu_qsctr_inc(int cpu)
+{
+	struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
+	rdp->passed_quiesc = 1;
+	rdp->passed_quiesc_completed = rdp->completed;
+}
+
+void rcu_bh_qsctr_inc(int cpu)
+{
+	struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
+	rdp->passed_quiesc = 1;
+	rdp->passed_quiesc_completed = rdp->completed;
+}
 
 #ifdef CONFIG_NO_HZ
 DEFINE_PER_CPU(struct rcu_dynticks, rcu_dynticks) = {
#2 lore raw

[tip:tracing/kmemtrace] fs, kmemtrace: fix linux/fdtable.h header file dependencies

In reply to a message not in the archive
Commit-ID:  fed06d464b8bd4521f5f59409d866f4916823f73
Gitweb:     http://git.kernel.org/tip/fed06d464b8bd4521f5f59409d866f4916823f73
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:29:05 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 25 Mar 2009 16:32:25 +0100

fs, kmemtrace: fix linux/fdtable.h header file dependencies

Impact: build fix

fdtable.h uses __init, but does not include init.h.

This can cause build failures on non-x86 architectures:

/home/mingo/tip/include/linux/fdtable.h:66: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'files_defer_init' make[2]: *** [fs/locks.o] Error 1

It got this header included indirectly via rcupdate.h's percpu.h inclusion - but that's not there anymore so the build broke. Fix it.

Cc: Pekka Enberg <[email protected]>
Cc: Eduard - Gabriel Munteanu <[email protected]>
Cc: [email protected]
LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

---
 include/linux/fdtable.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
include/linux/fdtable.h +3 -1
index 09d6c5b..a2ec74b 100644
@@ -5,12 +5,14 @@
 #ifndef __LINUX_FDTABLE_H
 #define __LINUX_FDTABLE_H
 
-#include <asm/atomic.h>
 #include <linux/posix_types.h>
 #include <linux/compiler.h>
 #include <linux/spinlock.h>
 #include <linux/rcupdate.h>
 #include <linux/types.h>
+#include <linux/init.h>
+
+#include <asm/atomic.h>
 
 /*
  * The default fd array needs to be at least BITS_PER_LONG,
#3 lore raw

[tip:tracing/kmemtrace] rcutree: fix rcu_tree_trace.c data structure dependencies

In reply to a message not in the archive
Commit-ID:  5d957021d326fbfdc1d7a4f11a3da1f6f82d6a36
Gitweb:     http://git.kernel.org/tip/5d957021d326fbfdc1d7a4f11a3da1f6f82d6a36
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:42:24 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 25 Mar 2009 16:42:24 +0100

rcutree: fix rcu_tree_trace.c data structure dependencies

Impact: build fix

We removed rcutree internals from the public rcutree.h file - but kernel/rcutree_trace.c depends on them.

Introduce kernel/rcutree.h for internal definitions. (Probably all the other data types from include/linux/rcutree.h could be moved here too - except rcu_data.)

Cc: Pekka Enberg <[email protected]>
Cc: Eduard - Gabriel Munteanu <[email protected]>
Cc: [email protected]
LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

---
 kernel/rcutree.c       |    8 ++++----
 kernel/rcutree.h       |   10 ++++++++++
 kernel/rcutree_trace.c |    2 ++
 3 files changed, 16 insertions(+), 4 deletions(-)
kernel/rcutree.c +4 -4
index a2015ed..7f32669 100644
@@ -72,11 +72,11 @@ EXPORT_SYMBOL_GPL(rcu_lock_map);
 	.n_force_qs_ngp = 0, \
 }
 
-static struct rcu_state rcu_state = RCU_STATE_INITIALIZER(rcu_state);
-static DEFINE_PER_CPU(struct rcu_data, rcu_data);
+struct rcu_state rcu_state = RCU_STATE_INITIALIZER(rcu_state);
+DEFINE_PER_CPU(struct rcu_data, rcu_data);
 
-static struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state);
-static DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
+struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state);
+DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
 
 /*
  * Increment the quiescent state counter.
kernel/rcutree.h new file +10 -0
new file mode 100644
index 0000000..5e872bb
@@ -0,0 +1,10 @@
+
+/*
+ * RCU implementation internal declarations:
+ */
+extern struct rcu_state rcu_state;
+DECLARE_PER_CPU(struct rcu_data, rcu_data);
+
+extern struct rcu_state rcu_bh_state;
+DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
+
kernel/rcutree_trace.c +2 -0
index d6db3e8..4ee954f 100644
@@ -43,6 +43,8 @@
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 
+#include "rcutree.h"
+
 static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp)
 {
 	if (!rdp->beenonline)
#4 lore raw

Re: [tip:tracing/kmemtrace] rcutree: fix rcu_tree_trace.c data structure dependencies

Quoted 9 lines · Ingo Molnar
Commit-ID:  5d957021d326fbfdc1d7a4f11a3da1f6f82d6a36
Gitweb:     http://git.kernel.org/tip/5d957021d326fbfdc1d7a4f11a3da1f6f82d6a36
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:42:24 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 25 Mar 2009 16:42:24 +0100

rcutree: fix rcu_tree_trace.c data structure dependencies

Quoted 8 lines

Impact: build fix

We removed rcutree internals from the public rcutree.h file - but kernel/rcutree_trace.c depends on them.

Introduce kernel/rcutree.h for internal definitions. (Probably all the other data types from include/linux/rcutree.h could be moved here too - except rcu_data.)

Paul ... what do you think? This is just an interim measure to get the build going - i think we could do more cleanups here perhaps, if you agree.

I think many of the data definitions (and the resulting include file dependencies) in include/linux/rcu*.h could move into kernel/rcu*.h and be privatized that way. 'struct rcu_state' would be an example.

Agreed?

Ingo

Reviewed-by
#5 lore raw

Re: [tip:tracing/kmemtrace] rcutree: fix rcu_tree_trace.c data structure dependencies

Quoted 17 lines · Ingo Molnar
Quoted 14 lines · Ingo Molnar
Commit-ID:  5d957021d326fbfdc1d7a4f11a3da1f6f82d6a36
Gitweb:     http://git.kernel.org/tip/5d957021d326fbfdc1d7a4f11a3da1f6f82d6a36
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:42:24 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 25 Mar 2009 16:42:24 +0100

rcutree: fix rcu_tree_trace.c data structure dependencies

Impact: build fix

We removed rcutree internals from the public rcutree.h file - but kernel/rcutree_trace.c depends on them.

Quoted 7 lines
Quoted 3 lines

Introduce kernel/rcutree.h for internal definitions. (Probably all the other data types from include/linux/rcutree.h could be moved here too - except rcu_data.)

Paul ... what do you think? This is just an interim measure to get the build going - i think we could do more cleanups here perhaps, if you agree.

I am generally in favor of this. I reviewed the above gitweb and it looks good to me, feel free to append:

Quoted 5 lines

I think many of the data definitions (and the resulting include file dependencies) in include/linux/rcu*.h could move into kernel/rcu*.h and be privatized that way. 'struct rcu_state' would be an example.

Agreed?

In principle, yes. In practice, my attempts to make headway in this direction have usually collided with the desire to inline some of the functions that appear on fastpaths, so I would prefer caution when moving in this direction, especially given my treercu-related todos, to which "speeding up synchronize_rcu()" just got added.

Thanx, Paul

#6 lore raw

Re: [tip:tracing/kmemtrace] rcutree: fix rcu_tree_trace.c data structure dependencies

Quoted 5 lines · Paul E. McKenney
Quoted 5 lines

I think many of the data definitions (and the resulting include file dependencies) in include/linux/rcu*.h could move into kernel/rcu*.h and be privatized that way. 'struct rcu_state' would be an example.

Quoted 8 lines
Quoted 1 line

Agreed?

In principle, yes. In practice, my attempts to make headway in this direction have usually collided with the desire to inline some of the functions that appear on fastpaths, so I would prefer caution when moving in this direction, especially given my treercu-related todos, to which "speeding up synchronize_rcu()" just got added.

I think there's a solution, for example the quiescent-state inlines could still be offered in a kernel/rcupdate_internals.h header to be included by kernel/softirq.c et al directly.

Otherwise ... i think it generally is not worth the trouble to put huge data types into common headers just to be able to inline into a small number of callsites.

Ingo

#7 lore raw

Re: [tip:tracing/kmemtrace] rcutree: fix rcu_tree_trace.c data structure dependencies

Quoted 17 lines · Ingo Molnar
Quoted 5 lines · Paul E. McKenney
Quoted 5 lines

I think many of the data definitions (and the resulting include file dependencies) in include/linux/rcu*.h could move into kernel/rcu*.h and be privatized that way. 'struct rcu_state' would be an example.

Quoted 8 lines
Quoted 1 line

Agreed?

In principle, yes. In practice, my attempts to make headway in this direction have usually collided with the desire to inline some of the functions that appear on fastpaths, so I would prefer caution when moving in this direction, especially given my treercu-related todos, to which "speeding up synchronize_rcu()" just got added.

Quoted 3 lines

I think there's a solution, for example the quiescent-state inlines could still be offered in a kernel/rcupdate_internals.h header to be included by kernel/softirq.c et al directly.

Could definitely do this, as I used to do it this way in a former life. As long as we are now OK with creating an additional header file or two per flavor of RCU.

Quoted 3 lines

Otherwise ... i think it generally is not worth the trouble to put huge data types into common headers just to be able to inline into a small number of callsites.

Information hiding can indeed be a good thing.

Thanx, Paul

#8 lore raw

[tip:tracing/kmemtrace] fs, kmemtrace: fix fs.h's PAGE_SIZE dependency

In reply to a message not in the archive
Commit-ID:  55553d2b7c253a1d676596fee680412727d84bc4
Gitweb:     http://git.kernel.org/tip/55553d2b7c253a1d676596fee680412727d84bc4
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:48:35 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 25 Mar 2009 16:50:47 +0100

fs, kmemtrace: fix fs.h's PAGE_SIZE dependency

Impact: build fix

ARM does not build due to fs.h using PAGE_SIZE but not including asm/page.h.

(This was masked before by rcupreempt.h including percpu.h which brought in asm/page.h indirectly.)

( A future enhancement would be to split out the simple_transaction
facility (only two usage sites) from fs.h, into a separate linux/simple_transaction.h header. )

Cc: Pekka Enberg <[email protected]>
Cc: Eduard - Gabriel Munteanu <[email protected]>
Cc: [email protected]
LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

---
 include/linux/fs.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/linux/fs.h +2 -0
index 159f7b8..79be937 100644
@@ -9,6 +9,8 @@
 #include <linux/limits.h>
 #include <linux/ioctl.h>
 
+#include <asm/page.h> /* for PAGE_SIZE */
+
 /*
  * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
  * the file limit at runtime and only root can increase the per-process
#9 lore raw

[tip:tracing/kmemtrace] rcutree: fix rcupreempt.c data structure dependencies

In reply to a message not in the archive
Commit-ID:  778ed34693a18b211e0ece9ceeeddd0cc51046d8
Gitweb:     http://git.kernel.org/tip/778ed34693a18b211e0ece9ceeeddd0cc51046d8
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:42:24 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 25 Mar 2009 17:02:53 +0100

rcutree: fix rcupreempt.c data structure dependencies

Impact: build fix

With percpu.h gone from rcupreempt.h, the percpu primitives there wont build anymore. Move them to the .c file instead.

Cc: Pekka Enberg <[email protected]>
Cc: Eduard - Gabriel Munteanu <[email protected]>
Cc: [email protected]
LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

---
 include/linux/rcupreempt.h |   51 +++++++------------------------------------
 kernel/rcupreempt.c        |   48 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 53 insertions(+), 46 deletions(-)
include/linux/rcupreempt.h +9 -42
index 5ff2d23..fce5227 100644
@@ -40,30 +40,15 @@
 #include <linux/cpumask.h>
 #include <linux/seqlock.h>
 
-struct rcu_dyntick_sched {
-	int dynticks;
-	int dynticks_snap;
-	int sched_qs;
-	int sched_qs_snap;
-	int sched_dynticks_snap;
-};
-
-DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched);
-
-static inline void rcu_qsctr_inc(int cpu)
-{
-	struct rcu_dyntick_sched *rdssp = &per_cpu(rcu_dyntick_sched, cpu);
-
-	rdssp->sched_qs++;
-}
-#define rcu_bh_qsctr_inc(cpu)
+extern void rcu_qsctr_inc(int cpu);
+static inline void rcu_bh_qsctr_inc(int cpu) { }
 
 /*
  * 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
+#define call_rcu_bh		call_rcu
 
 /**
  * call_rcu_sched - Queue RCU callback for invocation after sched grace period.
@@ -117,30 +102,12 @@ extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu);
 struct softirq_action;
 
 #ifdef CONFIG_NO_HZ
-
-static inline void rcu_enter_nohz(void)
-{
-	static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1);
-
-	smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */
-	__get_cpu_var(rcu_dyntick_sched).dynticks++;
-	WARN_ON_RATELIMIT(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1, &rs);
-}
-
-static inline void rcu_exit_nohz(void)
-{
-	static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1);
-
-	__get_cpu_var(rcu_dyntick_sched).dynticks++;
-	smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */
-	WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1),
-				&rs);
-}
-
-#else /* CONFIG_NO_HZ */
-#define rcu_enter_nohz()	do { } while (0)
-#define rcu_exit_nohz()		do { } while (0)
-#endif /* CONFIG_NO_HZ */
+extern void rcu_enter_nohz(void);
+extern void rcu_exit_nohz(void);
+#else
+# define rcu_enter_nohz()	do { } while (0)
+# define rcu_exit_nohz()	do { } while (0)
+#endif
 
 /*
  * A context switch is a grace period for rcupreempt synchronize_rcu()
kernel/rcupreempt.c +44 -4

61 lines not on this page · raw message

#10 lore raw

[tip:tracing/kmemtrace] fs.h: uninline simple_transaction_set()

In reply to a message not in the archive
Commit-ID:  44eea45ca9e25d6dd660d4806ef4c11209609e03
Gitweb:     http://git.kernel.org/tip/44eea45ca9e25d6dd660d4806ef4c11209609e03
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:48:35 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 25 Mar 2009 17:48:14 +0100

fs.h: uninline simple_transaction_set()

Move simple_transaction_set() to the other simple-transaction file helpers in fs/libfs.c.

This removes an implicit asm/page.h PAGE_SIZE dependency from fs.h (asm/page.h is not an exported header so HEADERS_CHECK fils), and also reduces kernel size a bit.

Cc: Al Viro <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: Eduard - Gabriel Munteanu <[email protected]>
Cc: [email protected]
LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

---
 fs/libfs.c         |   15 +++++++++++++++
 include/linux/fs.h |   16 +---------------
 2 files changed, 16 insertions(+), 15 deletions(-)
fs/libfs.c +15 -0
index 49b4409..a1db380 100644
@@ -574,6 +574,21 @@ ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
  * possibly a read which collects the result - which is stored in a
  * file-local buffer.
  */
+
+void simple_transaction_set(struct file *file, size_t n)
+{
+	struct simple_transaction_argresp *ar = file->private_data;
+
+	BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
+
+	/*
+	 * The barrier ensures that ar->size will really remain zero until
+	 * ar->data is ready for reading.
+	 */
+	smp_mb();
+	ar->size = n;
+}
+
 char *simple_transaction_get(struct file *file, const char __user *buf, size_t size)
 {
 	struct simple_transaction_argresp *ar;
include/linux/fs.h +1 -15
index 79be937..2ebe3ce 100644
@@ -9,8 +9,6 @@
 #include <linux/limits.h>
 #include <linux/ioctl.h>
 
-#include <asm/page.h> /* for PAGE_SIZE */
-
 /*
  * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
  * the file limit at runtime and only root can increase the per-process
@@ -2173,19 +2171,7 @@ ssize_t simple_transaction_read(struct file *file, char __user *buf,
 				size_t size, loff_t *pos);
 int simple_transaction_release(struct inode *inode, struct file *file);
 
-static inline void simple_transaction_set(struct file *file, size_t n)
-{
-	struct simple_transaction_argresp *ar = file->private_data;
-
-	BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
-
-	/*
-	 * The barrier ensures that ar->size will really remain zero until
-	 * ar->data is ready for reading.
-	 */
-	smp_mb();
-	ar->size = n;
-}
+void simple_transaction_set(struct file *file, size_t n);
 
 /*
  * simple attribute files
#11 lore raw

Re: [tip:tracing/kmemtrace] fs.h: uninline simple_transaction_set()

Quoted 9 lines · Ingo Molnar
Commit-ID:  44eea45ca9e25d6dd660d4806ef4c11209609e03
Gitweb:     http://git.kernel.org/tip/44eea45ca9e25d6dd660d4806ef4c11209609e03
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:48:35 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 25 Mar 2009 17:48:14 +0100

fs.h: uninline simple_transaction_set()

Quoted 7 lines

Cc: Al Viro <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: Eduard - Gabriel Munteanu <[email protected]>
Cc: [email protected]
LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

Pekka, Eduard - this commit is needed for the kmemtrace branch (otherwise headers_check fails) - but it needs the ack of Al Viro - so i've ordered the branch accordingly.

The fs.h changes look trivial and a step forward to me in untangling the data type dependency spaghetti (a tiny bit):

44eea45: fs.h: uninline simple_transaction_set()
55553d2: fs, kmemtrace: fix fs.h's PAGE_SIZE dependency
f3edf88: kmemtrace, fs, security: move alloc_secdata() and free_secdata() linux/security
f9ebc8b: fs: don't include <linux/gfp.h> to fix headers-export-check
c60d3ef: kmemtrace: fix build brekage in linux/fs.h

but it needs Acks.

Thanks,

Ingo

maintainer
#12 lore raw

Re: [tip:tracing/kmemtrace] fs.h: uninline simple_transaction_set()

In reply to Ingo Molnar
Quoted 7 lines · Ingo Molnar
Commit-ID:  44eea45ca9e25d6dd660d4806ef4c11209609e03
Gitweb:     http://git.kernel.org/tip/44eea45ca9e25d6dd660d4806ef4c11209609e03
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:48:35 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 25 Mar 2009 17:48:14 +0100
Quoted 8 lines

fs.h: uninline simple_transaction_set()

Move simple_transaction_set() to the other simple-transaction file helpers in fs/libfs.c.

This removes an implicit asm/page.h PAGE_SIZE dependency from fs.h (asm/page.h is not an exported header so HEADERS_CHECK fils), and also reduces kernel size a bit.

*shrug*

I can live with that. Which tree do you want that to go through? I'll be pushing VFS queue tonight.

#13 lore raw

Re: [tip:tracing/kmemtrace] fs.h: uninline simple_transaction_set()

Quoted 10 lines · Al Viro
Quoted 9 lines · Ingo Molnar
Commit-ID:  44eea45ca9e25d6dd660d4806ef4c11209609e03
Gitweb:     http://git.kernel.org/tip/44eea45ca9e25d6dd660d4806ef4c11209609e03
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:48:35 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 25 Mar 2009 17:48:14 +0100

fs.h: uninline simple_transaction_set()

Quoted 8 lines
Quoted 6 lines

Move simple_transaction_set() to the other simple-transaction file helpers in fs/libfs.c.

This removes an implicit asm/page.h PAGE_SIZE dependency from fs.h (asm/page.h is not an exported header so HEADERS_CHECK fils), and also reduces kernel size a bit.

*shrug*

Thanks for the encouragement - it must be a lot of fun for you to work with other people and you seem to be taking great pride in seeing improvements to the code you maintain and care about, no matter how insignificant they seem in isolation ;-)

Quoted 2 lines

I can live with that. Which tree do you want that to go through? I'll be pushing VFS queue tonight.

Either way is certainly fine with me, you are the maintainer so it's your call. I kept the branch isolated and can adopt.

Note: the patch i sent has some (very minimal) dependencies on a previous patchlet [which adds the asm/page.h include to fs.h - that dependency was implicit before], it will be all just fine if you ignore the fs.h reject when you apply the patch.

Thanks,

Ingo

#14 lore raw

[tip:tracing/kmemtrace] fs.h: uninline simple_transaction_set()

In reply to a message not in the archive
Commit-ID:  1a6ad03119ce01dd862b089b8b2d9d3848453b11
Gitweb:     http://git.kernel.org/tip/1a6ad03119ce01dd862b089b8b2d9d3848453b11
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:48:35 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 25 Mar 2009 18:27:56 +0100

fs.h: uninline simple_transaction_set()

Move simple_transaction_set() to the other simple-transaction file helpers in fs/libfs.c.

This removes an implicit asm/page.h PAGE_SIZE dependency from fs.h (asm/page.h is not an exported header so HEADERS_CHECK fils), and also reduces kernel size a bit.

Cc: Al Viro <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: Eduard - Gabriel Munteanu <[email protected]>
Cc: [email protected]
LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

---
 fs/libfs.c         |   16 ++++++++++++++++
 include/linux/fs.h |   16 +---------------
 2 files changed, 17 insertions(+), 15 deletions(-)
fs/libfs.c +16 -0
index 49b4409..c872c64 100644
@@ -574,6 +574,21 @@ ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
  * possibly a read which collects the result - which is stored in a
  * file-local buffer.
  */
+
+void simple_transaction_set(struct file *file, size_t n)
+{
+	struct simple_transaction_argresp *ar = file->private_data;
+
+	BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
+
+	/*
+	 * The barrier ensures that ar->size will really remain zero until
+	 * ar->data is ready for reading.
+	 */
+	smp_mb();
+	ar->size = n;
+}
+
 char *simple_transaction_get(struct file *file, const char __user *buf, size_t size)
 {
 	struct simple_transaction_argresp *ar;
@@ -819,6 +834,7 @@ EXPORT_SYMBOL(simple_sync_file);
 EXPORT_SYMBOL(simple_unlink);
 EXPORT_SYMBOL(simple_read_from_buffer);
 EXPORT_SYMBOL(memory_read_from_buffer);
+EXPORT_SYMBOL(simple_transaction_set);
 EXPORT_SYMBOL(simple_transaction_get);
 EXPORT_SYMBOL(simple_transaction_read);
 EXPORT_SYMBOL(simple_transaction_release);
include/linux/fs.h +1 -15
index 79be937..2ebe3ce 100644
@@ -9,8 +9,6 @@
 #include <linux/limits.h>
 #include <linux/ioctl.h>
 
-#include <asm/page.h> /* for PAGE_SIZE */
-
 /*
  * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
  * the file limit at runtime and only root can increase the per-process
@@ -2173,19 +2171,7 @@ ssize_t simple_transaction_read(struct file *file, char __user *buf,
 				size_t size, loff_t *pos);
 int simple_transaction_release(struct inode *inode, struct file *file);
 
-static inline void simple_transaction_set(struct file *file, size_t n)
-{
-	struct simple_transaction_argresp *ar = file->private_data;
-
-	BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
-
-	/*
-	 * The barrier ensures that ar->size will really remain zero until
-	 * ar->data is ready for reading.
-	 */
-	smp_mb();
-	ar->size = n;
-}
+void simple_transaction_set(struct file *file, size_t n);
 
 /*
  * simple attribute files
#15 lore raw

[tip:tracing/kmemtrace] fs.h: uninline simple_transaction_set()

In reply to a message not in the archive
Commit-ID:  a1525f87fd18c687edf376455c7d2e73c9b2cb6c
Gitweb:     http://git.kernel.org/tip/a1525f87fd18c687edf376455c7d2e73c9b2cb6c
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:48:35 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sat, 28 Mar 2009 12:44:06 +0100

fs.h: uninline simple_transaction_set()

Move simple_transaction_set() to the other simple-transaction file helpers in fs/libfs.c.

This removes an implicit asm/page.h PAGE_SIZE dependency from fs.h (asm/page.h is not an exported header so HEADERS_CHECK fils), and also reduces kernel size a bit.

Cc Alexey Dobriyan <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc Eduard - Gabriel Munteanu <[email protected]>

LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

---
 fs/libfs.c         |   16 ++++++++++++++++
 include/linux/fs.h |   16 +---------------
 2 files changed, 17 insertions(+), 15 deletions(-)
fs/libfs.c +16 -0
index 49b4409..c872c64 100644
@@ -574,6 +574,21 @@ ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
  * possibly a read which collects the result - which is stored in a
  * file-local buffer.
  */
+
+void simple_transaction_set(struct file *file, size_t n)
+{
+	struct simple_transaction_argresp *ar = file->private_data;
+
+	BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
+
+	/*
+	 * The barrier ensures that ar->size will really remain zero until
+	 * ar->data is ready for reading.
+	 */
+	smp_mb();
+	ar->size = n;
+}
+
 char *simple_transaction_get(struct file *file, const char __user *buf, size_t size)
 {
 	struct simple_transaction_argresp *ar;
@@ -819,6 +834,7 @@ EXPORT_SYMBOL(simple_sync_file);
 EXPORT_SYMBOL(simple_unlink);
 EXPORT_SYMBOL(simple_read_from_buffer);
 EXPORT_SYMBOL(memory_read_from_buffer);
+EXPORT_SYMBOL(simple_transaction_set);
 EXPORT_SYMBOL(simple_transaction_get);
 EXPORT_SYMBOL(simple_transaction_read);
 EXPORT_SYMBOL(simple_transaction_release);
include/linux/fs.h +1 -15
index 79be937..2ebe3ce 100644
@@ -9,8 +9,6 @@
 #include <linux/limits.h>
 #include <linux/ioctl.h>
 
-#include <asm/page.h> /* for PAGE_SIZE */
-
 /*
  * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
  * the file limit at runtime and only root can increase the per-process
@@ -2173,19 +2171,7 @@ ssize_t simple_transaction_read(struct file *file, char __user *buf,
 				size_t size, loff_t *pos);
 int simple_transaction_release(struct inode *inode, struct file *file);
 
-static inline void simple_transaction_set(struct file *file, size_t n)
-{
-	struct simple_transaction_argresp *ar = file->private_data;
-
-	BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
-
-	/*
-	 * The barrier ensures that ar->size will really remain zero until
-	 * ar->data is ready for reading.
-	 */
-	smp_mb();
-	ar->size = n;
-}
+void simple_transaction_set(struct file *file, size_t n);
 
 /*
  * simple attribute files
#16 lore raw

[tip:tracing/kmemtrace-v2] kmemtrace, fs: uninline simple_transaction_set()

In reply to a message not in the archive
Commit-ID:  76791ab2d5e00c1eef728a8df4347ba133760fb8
Gitweb:     http://git.kernel.org/tip/76791ab2d5e00c1eef728a8df4347ba133760fb8
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:48:35 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 3 Apr 2009 12:09:09 +0200

kmemtrace, fs: uninline simple_transaction_set()

Impact: cleanup

We want to remove percpu.h from rcupdate.h (for upcoming kmemtrace changes), but this is not possible currently without breaking the build because fs.h has an implicit include file depedency: it uses PAGE_SIZE but does not include asm/page.h which defines it.

This problem gets masked in practice because most fs.h using sites use rcupreempt.h (and other headers) which includes percpu.h which brings in asm/page.h indirectly.

We cannot add asm/page.h to asm/fs.h because page.h is not an exported header.

Move simple_transaction_set() to the other simple-transaction file helpers in fs/libfs.c.

This removes the include file hell and also reduces kernel size a bit.

Cc Alexey Dobriyan <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc Eduard - Gabriel Munteanu <[email protected]>

LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

---
 fs/libfs.c         |   16 ++++++++++++++++
 include/linux/fs.h |   14 +-------------
 2 files changed, 17 insertions(+), 13 deletions(-)
fs/libfs.c +16 -0
index 4910a36..cd22319 100644
@@ -575,6 +575,21 @@ ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
  * possibly a read which collects the result - which is stored in a
  * file-local buffer.
  */
+
+void simple_transaction_set(struct file *file, size_t n)
+{
+	struct simple_transaction_argresp *ar = file->private_data;
+
+	BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
+
+	/*
+	 * The barrier ensures that ar->size will really remain zero until
+	 * ar->data is ready for reading.
+	 */
+	smp_mb();
+	ar->size = n;
+}
+
 char *simple_transaction_get(struct file *file, const char __user *buf, size_t size)
 {
 	struct simple_transaction_argresp *ar;
@@ -820,6 +835,7 @@ EXPORT_SYMBOL(simple_sync_file);
 EXPORT_SYMBOL(simple_unlink);
 EXPORT_SYMBOL(simple_read_from_buffer);
 EXPORT_SYMBOL(memory_read_from_buffer);
+EXPORT_SYMBOL(simple_transaction_set);
 EXPORT_SYMBOL(simple_transaction_get);
 EXPORT_SYMBOL(simple_transaction_read);
 EXPORT_SYMBOL(simple_transaction_release);
include/linux/fs.h +1 -13
index fc4dc28..e4de2b5 100644
@@ -2323,19 +2323,7 @@ ssize_t simple_transaction_read(struct file *file, char __user *buf,
 				size_t size, loff_t *pos);
 int simple_transaction_release(struct inode *inode, struct file *file);
 
-static inline void simple_transaction_set(struct file *file, size_t n)
-{
-	struct simple_transaction_argresp *ar = file->private_data;
-
-	BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
-
-	/*
-	 * The barrier ensures that ar->size will really remain zero until
-	 * ar->data is ready for reading.
-	 */
-	smp_mb();
-	ar->size = n;
-}
+void simple_transaction_set(struct file *file, size_t n);
 
 /*
  * simple attribute files
#17 lore raw

[tip:tracing/kmemtrace-v2] kmemtrace, fs: fix linux/fdtable.h header file dependencies

In reply to a message not in the archive
Commit-ID:  21e5445928af0d80f7cf803a77f2b65e9e147890
Gitweb:     http://git.kernel.org/tip/21e5445928af0d80f7cf803a77f2b65e9e147890
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:29:05 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 3 Apr 2009 12:13:03 +0200

kmemtrace, fs: fix linux/fdtable.h header file dependencies

Impact: cleanup

We want to remove percpu.h from rcupdate.h (for upcoming kmemtrace changes), but this is not possible currently without breaking the build because fdtable.h has an implicit include file dependency: it uses __init does not include init.h.

This can cause build failures on non-x86 architectures:

/home/mingo/tip/include/linux/fdtable.h:66: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'files_defer_init' make[2]: *** [fs/locks.o] Error 1

We got this header included indirectly via rcupdate.h's percpu.h inclusion - but if that is not there the build will break.

Fix it.

Cc: Pekka Enberg <[email protected]>
Cc: Eduard - Gabriel Munteanu <[email protected]>
Cc: [email protected]
LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

---
 include/linux/fdtable.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
include/linux/fdtable.h +3 -1
index 09d6c5b..a2ec74b 100644
@@ -5,12 +5,14 @@
 #ifndef __LINUX_FDTABLE_H
 #define __LINUX_FDTABLE_H
 
-#include <asm/atomic.h>
 #include <linux/posix_types.h>
 #include <linux/compiler.h>
 #include <linux/spinlock.h>
 #include <linux/rcupdate.h>
 #include <linux/types.h>
+#include <linux/init.h>
+
+#include <asm/atomic.h>
 
 /*
  * The default fd array needs to be at least BITS_PER_LONG,
#18 lore raw

[tip:tracing/kmemtrace-v2] kmemtrace, rcu: fix linux/rcutree.h and linux/rcuclassic.h dependencies

In reply to a message not in the archive
Commit-ID:  b1f77b0581b8fd837acb4a973f7d5496cae6efee
Gitweb:     http://git.kernel.org/tip/b1f77b0581b8fd837acb4a973f7d5496cae6efee
Author:     Ingo Molnar <[email protected]>
AuthorDate: Fri, 13 Mar 2009 03:20:49 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 3 Apr 2009 12:23:02 +0200

kmemtrace, rcu: fix linux/rcutree.h and linux/rcuclassic.h dependencies

Impact: build fix for all non-x86 architectures

We want to remove percpu.h from rcuclassic.h/rcutree.h (for upcoming kmemtrace changes) but that would break the DECLARE_PER_CPU based declarations in these files.

Move the quiescent counter management functions to their respective RCU implementation .c files - they were slightly above the inlining limit anyway.

Cc: Pekka Enberg <[email protected]>
Cc: Eduard - Gabriel Munteanu <[email protected]>
Cc: [email protected]
LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

---
 include/linux/rcuclassic.h |   15 ++-------------
 include/linux/rcutree.h    |   26 ++------------------------
 kernel/rcuclassic.c        |   23 +++++++++++++++++++++--
 kernel/rcutree.c           |   28 ++++++++++++++++++++++++----
 4 files changed, 49 insertions(+), 43 deletions(-)
include/linux/rcuclassic.h +2 -13
index 80044a4..2d688b4 100644
@@ -108,25 +108,14 @@ struct rcu_data {
 	struct rcu_head barrier;
 };
 
-DECLARE_PER_CPU(struct rcu_data, rcu_data);
-DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
-
 /*
  * Increment the quiescent state counter.
  * The counter is a bit degenerated: We do not need to know
  * how many quiescent states passed, just if there was at least
  * one since the start of the grace period. Thus just a flag.
  */
-static inline void rcu_qsctr_inc(int cpu)
-{
-	struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
-	rdp->passed_quiesc = 1;
-}
-static inline void rcu_bh_qsctr_inc(int cpu)
-{
-	struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
-	rdp->passed_quiesc = 1;
-}
+extern void rcu_qsctr_inc(int cpu);
+extern void rcu_bh_qsctr_inc(int cpu);
 
 extern int rcu_pending(int cpu);
 extern int rcu_needs_cpu(int cpu);
include/linux/rcutree.h +2 -24
index a722fb6..5d6f425 100644
@@ -236,30 +236,8 @@ struct rcu_state {
 #endif /* #ifdef CONFIG_NO_HZ */
 };
 
-extern struct rcu_state rcu_state;
-DECLARE_PER_CPU(struct rcu_data, rcu_data);
-
-extern struct rcu_state rcu_bh_state;
-DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
-
-/*
- * Increment the quiescent state counter.
- * The counter is a bit degenerated: We do not need to know
- * how many quiescent states passed, just if there was at least
- * one since the start of the grace period. Thus just a flag.
- */
-static inline void rcu_qsctr_inc(int cpu)
-{
-	struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
-	rdp->passed_quiesc = 1;
-	rdp->passed_quiesc_completed = rdp->completed;
-}
-static inline void rcu_bh_qsctr_inc(int cpu)
-{
-	struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
-	rdp->passed_quiesc = 1;
-	rdp->passed_quiesc_completed = rdp->completed;
-}
+extern void rcu_qsctr_inc(int cpu);
+extern void rcu_bh_qsctr_inc(int cpu);
 
 extern int rcu_pending(int cpu);
 extern int rcu_needs_cpu(int cpu);
kernel/rcuclassic.c +21 -2
index 654c640..0f2b0b3 100644
@@ -65,6 +65,7 @@ static struct rcu_ctrlblk rcu_ctrlblk = {
 	.lock = __SPIN_LOCK_UNLOCKED(&rcu_ctrlblk.lock),
 	.cpumask = CPU_BITS_NONE,
 };
+
 static struct rcu_ctrlblk rcu_bh_ctrlblk = {
 	.cur = -300,
 	.completed = -300,
@@ -73,8 +74,26 @@ static struct rcu_ctrlblk rcu_bh_ctrlblk = {
 	.cpumask = CPU_BITS_NONE,
 };
 
-DEFINE_PER_CPU(struct rcu_data, rcu_data) = { 0L };
-DEFINE_PER_CPU(struct rcu_data, rcu_bh_data) = { 0L };
+static DEFINE_PER_CPU(struct rcu_data, rcu_data);
+static DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
+
+/*
+ * Increment the quiescent state counter.
+ * The counter is a bit degenerated: We do not need to know
+ * how many quiescent states passed, just if there was at least
+ * one since the start of the grace period. Thus just a flag.
+ */
+void rcu_qsctr_inc(int cpu)
+{
+	struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
+	rdp->passed_quiesc = 1;
+}
+
+void rcu_bh_qsctr_inc(int cpu)
+{
+	struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
+	rdp->passed_quiesc = 1;
+}
 
 static int blimit = 10;
 static int qhimark = 10000;
kernel/rcutree.c +24 -4
index 97ce315..a2015ed 100644
@@ -72,11 +72,31 @@ EXPORT_SYMBOL_GPL(rcu_lock_map);
 	.n_force_qs_ngp = 0, \
 }
 
-struct rcu_state rcu_state = RCU_STATE_INITIALIZER(rcu_state);
-DEFINE_PER_CPU(struct rcu_data, rcu_data);
+static struct rcu_state rcu_state = RCU_STATE_INITIALIZER(rcu_state);
+static DEFINE_PER_CPU(struct rcu_data, rcu_data);
 
-struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state);
-DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
+static struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state);
+static DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
+
+/*
+ * Increment the quiescent state counter.
+ * The counter is a bit degenerated: We do not need to know
+ * how many quiescent states passed, just if there was at least
+ * one since the start of the grace period. Thus just a flag.
+ */
+void rcu_qsctr_inc(int cpu)
+{
+	struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
+	rdp->passed_quiesc = 1;
+	rdp->passed_quiesc_completed = rdp->completed;
+}
+
+void rcu_bh_qsctr_inc(int cpu)
+{
+	struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
+	rdp->passed_quiesc = 1;
+	rdp->passed_quiesc_completed = rdp->completed;
+}
 
 #ifdef CONFIG_NO_HZ
 DEFINE_PER_CPU(struct rcu_dynticks, rcu_dynticks) = {
#19 lore raw

[tip:tracing/kmemtrace-v2] kmemtrace, rcu: fix rcu_tree_trace.c data structure dependencies

In reply to a message not in the archive
Commit-ID:  6258c4fb59e77d748f7efc2c137ad420372edd07
Gitweb:     http://git.kernel.org/tip/6258c4fb59e77d748f7efc2c137ad420372edd07
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:42:24 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 3 Apr 2009 12:23:03 +0200

kmemtrace, rcu: fix rcu_tree_trace.c data structure dependencies

Impact: cleanup

We want to remove rcutree internals from the public rcutree.h file for upcoming kmemtrace changes - but kernel/rcutree_trace.c depends on them.

Introduce kernel/rcutree.h for internal definitions. (Probably all the other data types from include/linux/rcutree.h could be moved here too - except rcu_data.)

Cc: Pekka Enberg <[email protected]>
Cc: Eduard - Gabriel Munteanu <[email protected]>
Cc: [email protected]
LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

---
 kernel/rcutree.c       |    8 ++++----
 kernel/rcutree.h       |   10 ++++++++++
 kernel/rcutree_trace.c |    2 ++
 3 files changed, 16 insertions(+), 4 deletions(-)
kernel/rcutree.c +4 -4
index a2015ed..7f32669 100644
@@ -72,11 +72,11 @@ EXPORT_SYMBOL_GPL(rcu_lock_map);
 	.n_force_qs_ngp = 0, \
 }
 
-static struct rcu_state rcu_state = RCU_STATE_INITIALIZER(rcu_state);
-static DEFINE_PER_CPU(struct rcu_data, rcu_data);
+struct rcu_state rcu_state = RCU_STATE_INITIALIZER(rcu_state);
+DEFINE_PER_CPU(struct rcu_data, rcu_data);
 
-static struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state);
-static DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
+struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state);
+DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
 
 /*
  * Increment the quiescent state counter.
kernel/rcutree.h new file +10 -0
new file mode 100644
index 0000000..5e872bb
@@ -0,0 +1,10 @@
+
+/*
+ * RCU implementation internal declarations:
+ */
+extern struct rcu_state rcu_state;
+DECLARE_PER_CPU(struct rcu_data, rcu_data);
+
+extern struct rcu_state rcu_bh_state;
+DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
+
kernel/rcutree_trace.c +2 -0
index d6db3e8..4ee954f 100644
@@ -43,6 +43,8 @@
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 
+#include "rcutree.h"
+
 static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp)
 {
 	if (!rdp->beenonline)
#20 lore raw

[tip:tracing/kmemtrace-v2] kmemtrace, rcu: fix rcupreempt.c data structure dependencies

In reply to a message not in the archive
Commit-ID:  a979241c532f07c201fe94e0a632107268f02578
Gitweb:     http://git.kernel.org/tip/a979241c532f07c201fe94e0a632107268f02578
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 25 Mar 2009 16:42:24 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 3 Apr 2009 12:23:04 +0200

kmemtrace, rcu: fix rcupreempt.c data structure dependencies

Impact: cleanup

We want to remove percpu.h from rcupreempt.h, but if we do that the percpu primitives there wont build anymore. Move them to the .c file instead.

Cc: Pekka Enberg <[email protected]>
Cc: Eduard - Gabriel Munteanu <[email protected]>
Cc: [email protected]
LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

---
 include/linux/rcupreempt.h |   51 +++++++------------------------------------
 kernel/rcupreempt.c        |   48 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 53 insertions(+), 46 deletions(-)
include/linux/rcupreempt.h +9 -42
index 74304b4..3eb8fdd 100644
@@ -40,30 +40,15 @@
 #include <linux/cpumask.h>
 #include <linux/seqlock.h>
 
-struct rcu_dyntick_sched {
-	int dynticks;
-	int dynticks_snap;
-	int sched_qs;
-	int sched_qs_snap;
-	int sched_dynticks_snap;
-};
-
-DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched);
-
-static inline void rcu_qsctr_inc(int cpu)
-{
-	struct rcu_dyntick_sched *rdssp = &per_cpu(rcu_dyntick_sched, cpu);
-
-	rdssp->sched_qs++;
-}
-#define rcu_bh_qsctr_inc(cpu)
+extern void rcu_qsctr_inc(int cpu);
+static inline void rcu_bh_qsctr_inc(int cpu) { }
 
 /*
  * 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
+#define call_rcu_bh		call_rcu
 
 /**
  * call_rcu_sched - Queue RCU callback for invocation after sched grace period.
@@ -117,30 +102,12 @@ extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu);
 struct softirq_action;
 
 #ifdef CONFIG_NO_HZ
-
-static inline void rcu_enter_nohz(void)
-{
-	static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1);
-
-	smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */
-	__get_cpu_var(rcu_dyntick_sched).dynticks++;
-	WARN_ON_RATELIMIT(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1, &rs);
-}
-
-static inline void rcu_exit_nohz(void)
-{
-	static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1);
-
-	__get_cpu_var(rcu_dyntick_sched).dynticks++;
-	smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */
-	WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1),
-				&rs);
-}
-
-#else /* CONFIG_NO_HZ */
-#define rcu_enter_nohz()	do { } while (0)
-#define rcu_exit_nohz()		do { } while (0)
-#endif /* CONFIG_NO_HZ */
+extern void rcu_enter_nohz(void);
+extern void rcu_exit_nohz(void);
+#else
+# define rcu_enter_nohz()	do { } while (0)
+# define rcu_exit_nohz()	do { } while (0)
+#endif
 
 /*
  * A context switch is a grace period for rcupreempt synchronize_rcu()
kernel/rcupreempt.c +44 -4

61 lines not on this page · raw message

#21 lore raw

[tip:tracing/kmemtrace-v2] kmemtrace, rcu: don't include unnecessary headers, allow kmemtrace w/ tracepoints

In reply to a message not in the archive
Commit-ID:  ac44021fccd8f1f2b267b004f23a2e8d7ef05f7b
Gitweb:     http://git.kernel.org/tip/ac44021fccd8f1f2b267b004f23a2e8d7ef05f7b
Author:     Eduard - Gabriel Munteanu <[email protected]>
AuthorDate: Mon, 23 Mar 2009 15:12:21 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 3 Apr 2009 12:23:05 +0200

kmemtrace, rcu: don't include unnecessary headers, allow kmemtrace w/ tracepoints

Impact: cleanup

linux/percpu.h includes linux/slab.h, which generates circular inclusion dependencies when trying to switch kmemtrace to use tracepoints instead of markers.

This patch allows tracing within slab headers' inline functions.

Cc Eduard - Gabriel Munteanu <[email protected]>

LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>

---
 include/linux/rcuclassic.h |    1 -
 include/linux/rcupdate.h   |    1 -
 include/linux/rcupreempt.h |    2 +-
 include/linux/rcutree.h    |    1 -
 4 files changed, 1 insertions(+), 4 deletions(-)
include/linux/rcuclassic.h +0 -1
index 2d688b4..bfd92e1 100644
@@ -36,7 +36,6 @@
 #include <linux/cache.h>
 #include <linux/spinlock.h>
 #include <linux/threads.h>
-#include <linux/percpu.h>
 #include <linux/cpumask.h>
 #include <linux/seqlock.h>
 
include/linux/rcupdate.h +0 -1
index 528343e..15fbb3c 100644
@@ -36,7 +36,6 @@
 #include <linux/cache.h>
 #include <linux/spinlock.h>
 #include <linux/threads.h>
-#include <linux/percpu.h>
 #include <linux/cpumask.h>
 #include <linux/seqlock.h>
 #include <linux/lockdep.h>
include/linux/rcupreempt.h +1 -1
index 3eb8fdd..fce5227 100644
@@ -36,7 +36,7 @@
 #include <linux/cache.h>
 #include <linux/spinlock.h>
 #include <linux/threads.h>
-#include <linux/percpu.h>
+#include <linux/smp.h>
 #include <linux/cpumask.h>
 #include <linux/seqlock.h>
 
include/linux/rcutree.h +0 -1
index 5d6f425..0cdda00 100644
@@ -33,7 +33,6 @@
 #include <linux/cache.h>
 #include <linux/spinlock.h>
 #include <linux/threads.h>
-#include <linux/percpu.h>
 #include <linux/cpumask.h>
 #include <linux/seqlock.h>