RCU: Don't try and predeclare inline funcs as it upsets some versions of gcc
David Howells [Wed, 15 Apr 2009 18:35:01 +0000 (19:35 +0100)]
Don't try and predeclare inline funcs like this:

static inline void wait_migrated_callbacks(void)
static void _rcu_barrier(enum rcu_barrier type)
static inline void wait_migrated_callbacks(void)
wait_event(rcu_migrate_wq, !atomic_read(&rcu_migrate_type_count));

as it upsets some versions of gcc under some circumstances:

kernel/rcupdate.c: In function `_rcu_barrier':
kernel/rcupdate.c:125: sorry, unimplemented: inlining failed in call to 'wait_migrated_callbacks': function body not available
kernel/rcupdate.c:152: sorry, unimplemented: called from here

This can be dealt with by simply putting the static variables (rcu_migrate_*)
at the top, and moving the implementation of the function up so that it
replaces its forward declaration.

Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Dipankar Sarma <dipankar@in.ibm.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


index 2c7b845..a967c9f 100644 (file)
@@ -58,6 +58,10 @@ static DEFINE_MUTEX(rcu_barrier_mutex);
 static struct completion rcu_barrier_completion;
 int rcu_scheduler_active __read_mostly;
+static atomic_t rcu_migrate_type_count = ATOMIC_INIT(0);
+static struct rcu_head rcu_migrate_head[3];
+static DECLARE_WAIT_QUEUE_HEAD(rcu_migrate_wq);
  * Awaken the corresponding synchronize_rcu() instance now that a
  * grace period has elapsed.
@@ -122,7 +126,10 @@ static void rcu_barrier_func(void *type)
-static inline void wait_migrated_callbacks(void);
+static inline void wait_migrated_callbacks(void)
+       wait_event(rcu_migrate_wq, !atomic_read(&rcu_migrate_type_count));
  * Orchestrate the specified type of RCU barrier, waiting for all
@@ -179,21 +186,12 @@ void rcu_barrier_sched(void)
-static atomic_t rcu_migrate_type_count = ATOMIC_INIT(0);
-static struct rcu_head rcu_migrate_head[3];
-static DECLARE_WAIT_QUEUE_HEAD(rcu_migrate_wq);
 static void rcu_migrate_callback(struct rcu_head *notused)
        if (atomic_dec_and_test(&rcu_migrate_type_count))
-static inline void wait_migrated_callbacks(void)
-       wait_event(rcu_migrate_wq, !atomic_read(&rcu_migrate_type_count));
 static int __cpuinit rcu_barrier_cpu_hotplug(struct notifier_block *self,
                unsigned long action, void *hcpu)