Skip to contentSkip to conversation

rcupdate: move synchronize_sched() back to rcupdate.c

PATCH In review Lai Jiangshan 2 participants 3 messages Nov 4, 2008 – Nov 5, 2008 RCU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rcupdate: move synchronize_sched() back to rcupdate.c

this fix will increase about several hundred bytes to the kernel text for rcuclassic.

but it will increase readability for rcupdate codes. and make code tools happy(ctags, kernel-doc ...).

---

include/linux/rcuclassic.h +0 -2
index 5f89b62..1d20922 100644
@@ -166,8 +166,6 @@ extern struct lockdep_map rcu_lock_map;
 		local_bh_enable(); \
 	} while (0)
 
-#define __synchronize_sched() synchronize_rcu()
-
 #define call_rcu_sched(head, func) call_rcu(head, func)
 
 extern void __rcu_init(void);
include/linux/rcupdate.h +1 -39
index 86f1f5e..d2b5232 100644
@@ -189,45 +189,6 @@ struct rcu_head {
 		(p) = (v); \
 	})
 
-/* Infrastructure to implement the synchronize_() primitives. */
-
-struct rcu_synchronize {
-	struct rcu_head head;
-	struct completion completion;
-};
-
-extern void wakeme_after_rcu(struct rcu_head  *head);
-
-#define synchronize_rcu_xxx(name, func) \
-void name(void) \
-{ \
-	struct rcu_synchronize rcu; \
-	\
-	init_completion(&rcu.completion); \
-	/* Will wake me after RCU finished. */ \
-	func(&rcu.head, wakeme_after_rcu); \
-	/* Wait for it. */ \
-	wait_for_completion(&rcu.completion); \
-}
-
-/**
- * synchronize_sched - block until all CPUs have exited any non-preemptive
- * kernel code sequences.
- *
- * This means that all preempt_disable code sequences, including NMI and
- * hardware-interrupt handlers, in progress on entry will have completed
- * before this primitive returns.  However, this does not guarantee that
- * softirq handlers will have completed, since in some kernels, these
- * handlers can run in process context, and can block.
- *
- * This primitive provides the guarantees made by the (now removed)
- * synchronize_kernel() API.  In contrast, synchronize_rcu() only
- * guarantees that rcu_read_lock() sections will have completed.
- * In "classic RCU", these two guarantees happen to be one and
- * the same, but can differ in realtime RCU implementations.
- */
-#define synchronize_sched() __synchronize_sched()
-
 /**
  * call_rcu - Queue an RCU callback for invocation after a grace period.
  * @head: structure to be used for queueing the RCU updates.
@@ -265,6 +226,7 @@ extern void call_rcu_bh(struct rcu_head *head,
 
 /* Exported common interfaces */
 extern void synchronize_rcu(void);
+extern void synchronize_sched(void);
 extern void rcu_barrier(void);
 extern void rcu_barrier_bh(void);
 extern void rcu_barrier_sched(void);
include/linux/rcupreempt.h +0 -2
index 3e05c09..448cd23 100644
@@ -87,8 +87,6 @@ extern int rcu_needs_cpu(int cpu);
 #define __rcu_read_lock_bh()	{ rcu_read_lock(); local_bh_disable(); }
 #define __rcu_read_unlock_bh()	{ local_bh_enable(); rcu_read_unlock(); }
 
-extern void __synchronize_sched(void);
-
 extern void __rcu_init(void);
 extern void rcu_init_sched(void);
 extern void rcu_check_callbacks(int cpu, int user);
kernel/rcupdate.c +44 -3

65 lines not on this page · raw message

kernel/rcupreempt.c +0 -9
index 59236e8..2068ad9 100644
@@ -1161,15 +1161,6 @@ void call_rcu_sched(struct rcu_head *head, void (*func)(struct rcu_head *rcu))
 EXPORT_SYMBOL_GPL(call_rcu_sched);
 
 /*
- * Wait until all currently running preempt_disable() code segments
- * (including hardware-irq-disable segments) complete.  Note that
- * in -rt this does -not- necessarily result in all currently executing
- * interrupt -handlers- having completed.
- */
-synchronize_rcu_xxx(__synchronize_sched, call_rcu_sched)
-EXPORT_SYMBOL_GPL(__synchronize_sched);
-
-/*
  * kthread function that manages call_rcu_sched grace periods.
  */
 static int rcu_sched_grace_period(void *arg)
#1 lore raw
Quoted 2 lines · Lai Jiangshan

this fix will increase about several hundred bytes to the kernel text for rcuclassic.

hm, why is that, and is it true for the full vmlinux as well, for a reasonably large .config?

Do you get the size increase even if these two are enabled:

CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_OPTIMIZE_INLINING=y

?

i'd expect the opposite or same-size: given that an ugly quasi-inlining macro is replaced with a shared, out of line function.

Ingo

#2 lore raw
Quoted 8 lines · Ingo Molnar
Quoted 2 lines · Lai Jiangshan

this fix will increase about several hundred bytes to the kernel text for rcuclassic.

hm, why is that, and is it true for the full vmlinux as well, for a reasonably large .config?

Quoted 6 lines

Do you get the size increase even if these two are enabled:

CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_OPTIMIZE_INLINING=y

?

almost the same, a half of bytes added to kernel text is from this line:
EXPORT_SYMBOL_GPL(synchronize_sched);

Quoted 8 lines

i'd expect the opposite or same-size: given that an ugly quasi-inlining macro is replaced with a shared, out of line function.

Ingo