Message ID | 20110503062528.GV2294@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, May 02, 2011 at 11:25:28PM -0700, Paul E. McKenney wrote: > > > > How significantly? As I wrote in other mail I compiled two TINY_RCU > > > > kernel with and without the patch and I didn't see memory footprint > > > > increase at all. May be I measure it incorrectly, but what I see is that > > > > with out of line function + export text section becomes 64 byte bigger, but > > > > data section becomes 64 byte smaller: > > > > > > > > text data bss dec hex filename > > > > 4544134 590596 2023424 7158154 6d398a vmlinux inline > > > > 4544198 590532 2023424 7158154 6d398a vmlinux.ol out of line > > > > > > Did you add the exports that would be needed to allow KVM to call > > > the functions in the inline case? > > > > > Yes, this is with and without patch applied. When patch is applied the > > function is out of line and exported. > > OK, here is what I am suggesting -- create a separate API for virtualization, > make it be an empty static inline function for TINY, and make it a wrapper > for TREE. This gets rid of the export in the TINY case, and takes advantage > of the single-CPU constraint in the TINY case. So this gains the benefit > of uninlining rcu_note_context_switch(), but avoids paying the cost of the > EXPORT_SYMBOL_GPL(). > > Then you call rcu_virt_note_context_switch() in place of > rcu_note_context_switch() from KVM. > > Does this make sense? > If TINY RCU has such strict code size requirement then yes. I will make another patch based on this and resend. -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h index 8e5f7cf..3cc60c0 100644 --- a/include/linux/rcutiny.h +++ b/include/linux/rcutiny.h @@ -96,6 +96,14 @@ static inline int rcu_needs_cpu(int cpu) extern void rcu_note_context_switch(int cpu); /* + * Take advantage of the fact that there is only one CPU, which + * allows us to ignore virtualization-based context switches. + */ +static inline void rcu_virt_note_context_switch(int cpu) +{ +} + +/* * Return the number of grace periods. */ static inline long rcu_batches_completed(void) diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index 284dad1..e65d066 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h @@ -35,6 +35,16 @@ extern void rcu_note_context_switch(int cpu); extern int rcu_needs_cpu(int cpu); extern void rcu_cpu_stall_reset(void); +/* + * Note a virtualization-based context switch. This is simply a + * wrapper around rcu_note_context_switch(), which allows TINY_RCU + * to save a few bytes. + */ +static inline void rcu_virt_note_context_switch(int cpu) +{ + rcu_note_context_switch(cpu); +} + #ifdef CONFIG_TREE_PREEMPT_RCU extern void exit_rcu(void); diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c index 44d6479..8071010 100644 --- a/kernel/rcutiny.c +++ b/kernel/rcutiny.c @@ -83,7 +83,6 @@ void rcu_note_context_switch(int cpu) rcu_sched_qs(cpu); rcu_preempt_note_context_switch(); } -EXPORT_SYMBOL_GPL(rcu_note_context_switch); /* * Helper function for rcu_sched_qs() and rcu_bh_qs().