v4 RCU: the bloatwatch edition
PATCH 1/1 v4 RCU: the bloatwatch edition
This patch is a version of RCU designed for (!SMP && EMBEDDED) provided as a proof of concept of a small-footprint RCU implementation. In particular, the implementation of synchronize_rcu() is extremely lightweight and high performance. It passes rcutorture testing in each of the four relevant configurations (combinations of NO_HZ and PREEMPT) on x86. This saves about 900 bytes compared to Classic RCU, and a couple kilobytes compared to Hierarchical RCU (updated to 2.6.29):
CONFIG_CLASSIC_RCU: text data bss dec filename 532 24 24 580 kernel/rcupdate.o 1344 64 124 1532 kernel/rcuclassic.o 2112 Total CONFIG_TREE_RCU: text data bss dec filename 532 24 24 580 kernel/rcupdate.o 2622 240 180 3042 kernel/rcutree.o 3622 Total CONFIG_TINY_RCU: text data bss dec filename 494 24 24 542 kernel/rcupdate.o 463 36 0 499 kernel/rcutiny.o 1041 Total
Changes from v3 (http://lkml.org/lkml/2009/3/29/221) include:
o Changed rcu_batches_completed(), rcu_batches_completed_bh()
rcu_enter_nohz(), rcu_exit_nohz(), rcu_nmi_enter(), and rcu_nmi_exit(), to be static inlines, as suggested by David Howells. Doing this saves about 100 bytes from rcutiny.o. (The numbers between v3 and this v4 of the patch are not directly comparable, since they are against different versions of Linux.)
Changes from v2 (http://lkml.org/lkml/2009/2/3/333) include:
o Fix whitespace issues.
o Change short-circuit "||" operator to instead be "+" in order to
fix performance bug noted by "kraai" on LWN. (http://lwn.net/Articles/324348/)
Changes from v1 (http://lkml.org/lkml/2009/1/13/440) include:
o This version depends on EMBEDDED as well as !SMP, as suggested
by Ingo.
o Updated rcu_needs_cpu() to unconditionally return zero,
permitting the CPU to enter dynticks-idle mode at any time. This works because callbacks can be invoked upon entry to dynticks-idle mode.
o I am now OK with this being included, based on a poll at the
Kernel Miniconf at linux.conf.au, where about ten people said that they cared about saving 900 bytes on single-CPU systems.
o Applies to both mainline and tip/core/rcu.
---
include/linux/hardirq.h | 52 ++++++++-- include/linux/rcupdate.h | 2 include/linux/rcutiny.h | 103 ++++++++++++++++++++ init/Kconfig | 7 + kernel/Makefile | 1 kernel/rcupdate.c | 4 kernel/rcutiny.c | 238 +++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 400 insertions(+), 7 deletions(-)
include/linux/hardirq.h +45 -7
@@ -119,17 +119,55 @@ static inline void account_system_vtime( }#endif -#if defined(CONFIG_NO_HZ ) && !defined(CONFIG_CLASSIC_RCU ) +#if !defined(CONFIG_NO_HZ ) || defined(CONFIG_CLASSIC_RCU ) + +static inline void rcu_irq_enter (void ) +{ +} + +static inline void rcu_irq_exit (void ) +{ +} + +static inline void rcu_nmi_enter (void ) +{ +} + +static inline void rcu_nmi_exit (void ) +{ +} + +#elif defined(CONFIG_TINY_RCU ) + +extern void rcu_enter_nohz (void ); +extern void rcu_exit_nohz (void ); + +static inline void rcu_irq_enter (void ) +{ +rcu_exit_nohz (); +} + +static inline void rcu_irq_exit (void ) +{ +rcu_enter_nohz (); +} + +static inline void rcu_nmi_enter (void ) +{ +} + +static inline void rcu_nmi_exit (void ) +{ +} + +#else +extern void rcu_irq_enter (void );extern void rcu_irq_exit (void );extern void rcu_nmi_enter (void );extern void rcu_nmi_exit (void ); -#else -# define rcu_irq_enter () do { } while (0) -# define rcu_irq_exit () do { } while (0) -# define rcu_nmi_enter () do { } while (0) -# define rcu_nmi_exit () do { } while (0) -#endif /* #if defined(CONFIG_NO_HZ) && !defined(CONFIG_CLASSIC_RCU) */ + +#endif /* * It is safe to do non-atomic ops on ->hardirq_context,
include/linux/rcupdate.h +2 -0
@@ -60,6 +60,8 @@ extern int rcu_scheduler_active;#include <linux/rcutree.h> #elif defined(CONFIG_PREEMPT_RCU )#include <linux/rcupreempt.h> +#elif CONFIG_TINY_RCU +#include <linux/rcutiny.h> #else #error "Unknown RCU implementation specified to kernel configuration"#endif /* #else #if defined(CONFIG_CLASSIC_RCU) */
include/linux/rcutiny.h +103 -0
103 lines not on this page · raw message
init/Kconfig +7 -0
@@ -271,6 +271,13 @@ config PREEMPT_RCU now-naive assumptions about each RCU read-side critical section remaining on a given CPU through its execution. +config TINY_RCU + bool "Tiny-Memory RCU" + depends on !SMP && EMBEDDED + help + This option greatly reduces the memory footprint of RCU, + but is usable only on UP systems. + endchoice config RCU_TRACE
kernel/Makefile +1 -0
@@ -80,6 +80,7 @@ obj-$(CONFIG_RCU_TORTURE_TEST) += rcutor obj-$(CONFIG_CLASSIC_RCU) += rcuclassic.o obj-$(CONFIG_TREE_RCU) += rcutree.o obj-$(CONFIG_PREEMPT_RCU) += rcupreempt.o +obj-$(CONFIG_TINY_RCU) += rcutiny.o obj-$(CONFIG_TREE_RCU_TRACE) += rcutree_trace.o obj-$(CONFIG_PREEMPT_RCU_TRACE) += rcupreempt_trace.o obj-$(CONFIG_RELAY) += relay.o
kernel/rcupdate.c +4 -0
@@ -74,6 +74,8 @@ void wakeme_after_rcu(struct rcu_head *complete (&rcu->completion); } +#ifndef CONFIG_TINY_RCU +/** * synchronize_rcu - wait until a grace period has elapsed. *
@@ -98,6 +100,8 @@ void synchronize_rcu(void) }EXPORT_SYMBOL_GPL (synchronize_rcu); +#endif /* #ifndef CONFIG_TINY_RCU */ +static void rcu_barrier_callback (struct rcu_head *notused) {if (atomic_dec_and_test (&rcu_barrier_cpu_count))
kernel/rcutiny.c +238 -0
238 lines not on this page · raw message
Quoted 9 lines · Paul E. McKenney
This patch is a version of RCU designed for (!SMP && EMBEDDED) provided as a proof of concept of a small-footprint RCU implementation. In particular, the implementation of
synchronize_rcu()is extremely lightweight and high performance. It passes rcutorture testing in each of the four relevant configurations (combinations ofNO_HZand PREEMPT) on x86. This saves about 900 bytes compared to Classic RCU, and a couple kilobytes compared to Hierarchical RCU (updated to 2.6.29):
...Signed-off-by Paul E. McKenney <[email protected]>
Quoted 12 lines · David Howells
Quoted 9 lines · Paul E. McKenney
This patch is a version of RCU designed for (!SMP && EMBEDDED) provided as a proof of concept of a small-footprint RCU implementation. In particular, the implementation of
synchronize_rcu()is extremely lightweight and high performance. It passes rcutorture testing in each of the four relevant configurations (combinations ofNO_HZand PREEMPT) on x86. This saves about 900 bytes compared to Classic RCU, and a couple kilobytes compared to Hierarchical RCU (updated to 2.6.29):
...Signed-off-by Paul E. McKenney <[email protected]>
Quoted 1 line
Acked-by David Howells <[email protected]>
i'm wondering what Andrew thinks - he had objections, right?
Ingo
Quoted 15 lines · On Wed, 6 May 2009 14:09:09 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 12 lines · David Howells
Quoted 9 lines · Paul E. McKenney
This patch is a version of RCU designed for (!SMP && EMBEDDED) provided as a proof of concept of a small-footprint RCU implementation. In particular, the implementation of
synchronize_rcu()is extremely lightweight and high performance. It passes rcutorture testing in each of the four relevant configurations (combinations ofNO_HZand PREEMPT) on x86. This saves about 900 bytes compared to Classic RCU, and a couple kilobytes compared to Hierarchical RCU (updated to 2.6.29):
...Signed-off-by Paul E. McKenney <[email protected]>
Quoted 4 lines
Quoted 1 line
Acked-by David Howells <[email protected]>i'm wondering what Andrew thinks - he had objections, right?
More like "concerns". It's unobvious to me that the modest .text savings justify the costs of an additional RCU implementation. Where those costs include
- additional maintenance work and
- the reduced code reliability which comes from fragmenting the tester base. This will mostly affect users of the less popular RCU implementations.
But hey, maybe I'm wrong. And maybe I'm right, but we'll merge it anyway ;)
Quoted 27 lines · Andrew Morton
Quoted 15 lines · On Wed, 6 May 2009 14:09:09 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 12 lines · David Howells
Quoted 9 lines · Paul E. McKenney
This patch is a version of RCU designed for (!SMP && EMBEDDED) provided as a proof of concept of a small-footprint RCU implementation. In particular, the implementation of
synchronize_rcu()is extremely lightweight and high performance. It passes rcutorture testing in each of the four relevant configurations (combinations ofNO_HZand PREEMPT) on x86. This saves about 900 bytes compared to Classic RCU, and a couple kilobytes compared to Hierarchical RCU (updated to 2.6.29):
...Signed-off-by Paul E. McKenney <[email protected]>Quoted 4 lines
Quoted 1 line
Acked-by David Howells <[email protected]>i'm wondering what Andrew thinks - he had objections, right?
More like "concerns". It's unobvious to me that the modest .text savings justify the costs of an additional RCU implementation. Where those costs include
Quoted 7 lines
- additional maintenance work and
- the reduced code reliability which comes from fragmenting the tester base. This will mostly affect users of the less popular RCU implementations.
But hey, maybe I'm wrong. And maybe I'm right, but we'll merge it anyway ;)
;-)
How about if acceptance of Tiny RCU happens at the same time as Classic RCU is dropped? That would be a large net decrease in code size and complexity.
Thanx, Paul
Quoted 13 lines · On Wed, 6 May 2009 12:02:16 -0700 "Paul E. McKenney"…
Quoted 13 lines
Quoted 2 lines
i'm wondering what Andrew thinks - he had objections, right?
More like "concerns". It's unobvious to me that the modest .text savings justify the costs of an additional RCU implementation. Where those costs include
- additional maintenance work and
- the reduced code reliability which comes from fragmenting the tester base. This will mostly affect users of the less popular RCU implementations.
Quoted 7 lines
Quoted 1 line
But hey, maybe I'm wrong. And maybe I'm right, but we'll merge it anyway ;)
;-)
How about if acceptance of Tiny RCU happens at the same time as Classic RCU is dropped? That would be a large net decrease in code size and complexity.
It's a bit artificial to link the two actions. Removing something:
good. Adding something: bad. good+bad == less good ;)
Quoted 18 lines · Andrew Morton
Quoted 15 lines · On Wed, 6 May 2009 12:02:16 -0700 "Paul E. McKenney"…
Quoted 14 lines
Quoted 2 lines
i'm wondering what Andrew thinks - he had objections, right?
More like "concerns". It's unobvious to me that the modest .text savings justify the costs of an additional RCU implementation. Where those costs include
- additional maintenance work and
- the reduced code reliability which comes from fragmenting the tester base. This will mostly affect users of the less popular RCU implementations.
But hey, maybe I'm wrong. And maybe I'm right, but we'll merge it anyway ;)
Quoted 8 lines
Quoted 5 lines
;-)
How about if acceptance of Tiny RCU happens at the same time as Classic RCU is dropped? That would be a large net decrease in code size and complexity.
It's a bit artificial to link the two actions. Removing something:
good. Adding something: bad. good+bad == less good ;)
Ah, but from a memory-footprint perspective, removing Classic RCU is about 1.5K bad, given the larger memory footprint of Hierarchical RCU. So, in this case, removing Classic RCU: good complexity, bad memory footprint. Adding Tiny RCU: slightly bad complexity, good memory footprint.
So, replacing Classic RCU with Tiny RCU improves (reduces) both the complexity and the memory footprint.
Thanx, Paul
Quoted 3 lines · Andrew Morton
More like "concerns". It's unobvious to me that the modest .text savings justify the costs of an additional RCU implementation. Where those costs include
It may be more than just modest .text savings. Being optimised to be as simple as possible, and to only support one CPU, it may be quicker too. I'm not sure how best to benchmark it though.
David
Quoted 9 lines · David Howells
Quoted 3 lines · Andrew Morton
More like "concerns". It's unobvious to me that the modest .text savings justify the costs of an additional RCU implementation. Where those costs include
It may be more than just modest .text savings. Being optimised to be as simple as possible, and to only support one CPU, it may be quicker too. I'm not sure how best to benchmark it though.
The read side is unchanged, but the update side is another story, given that synchronize_rcu()'s latency decreases from multiple milliseconds to the sub-microsecond range:
void synchronize_rcu(void)
{
unsigned long flags;
local_irq_save(flags);
rcu_ctrlblk.completed++;
local_irq_restore(flags);
}So boot speed is one possible metric, depending on how many synchronize_rcu() invocations are in your arch's boot path. It appears that x86 has a fair number. ;-)
Thanx, Paul
Hi Paul,
Are you going to push your RCU patch for this merge window?
David
Quoted 3 lines · David Howells
Hi Paul,
Are you going to push your RCU patch for this merge window?
Andrew needs to be convinced for that to happen.
Ingo
Quoted 9 lines · On Mon, 22 Jun 2009 14:49:51 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 3 lines · David Howells
Hi Paul,
Are you going to push your RCU patch for this merge window?
Andrew needs to be convinced for that to happen.
whome? I rarely have firm opinions on anything. iirc the question here was "is it worth adding another RCU implementation to save 900 bytes"?
I find it pretty hard to see how to come up with "yes" for that one but it's hardly a huge issue. If you guys feel otherwise then go wild.
Quoted 12 lines · Andrew Morton
Quoted 9 lines · On Mon, 22 Jun 2009 14:49:51 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 3 lines · David Howells
Hi Paul,
Are you going to push your RCU patch for this merge window?
Andrew needs to be convinced for that to happen.
Quoted 6 lines
whome? I rarely have firm opinions on anything. iirc the question here was "is it worth adding another RCU implementation to save 900 bytes"?
I find it pretty hard to see how to come up with "yes" for that one but it's hardly a huge issue. If you guys feel otherwise then go wild.
Well, I do need to pull the "expedited" interface into the bloatwatch version, and my update of rcutorture made me realize that I can cut out a few more bytes, so I will submit an update. For what it is worth, here are the opinions expressed on LKML:
+ Ingo Molnar: good documentation, minimal RCU implementation.
? Andi Kleen: will there be !SMP systems in the future?
+ Lennert Buytenhek: there will be !SMP ARM for a long time.
+ Paul Mundt: good idea for more-constrained SH platforms.
+ David Howells: Acked-by. works on FRV board.
? Andrew Morton: do we really need another RCU implementation?
Of course, I well remember programming systems with 4K of core memory back in the 1970s, and therefore feel a bit guilty about sticking deep embedded platforms with the increase in memory footprint represented by Hierarchical RCU compared to Classic RCU. And Bloatwatch RCU is much smaller and easier to understand/maintain than is Classic RCU.
So, again, I will forward port, optimize, test, and resubmit.
Thanx, Paul
Quoted 5 lines · Paul E. McKenney
Of course, I well remember programming systems with 4K of core memory back in the 1970s, and therefore feel a bit guilty about sticking deep embedded platforms with the increase in memory footprint represented by Hierarchical RCU compared to Classic RCU. And Bloatwatch RCU is much smaller and easier to understand/maintain than is Classic RCU.
Both Fujitsu and Panasonic really want to keep the kernel size down. Squeezing a kernel into a megabyte or less of flash is one of the main aims, and anything that saves nearly 1K is not to be sneered at.
David
Quoted 29 lines · Paul E. McKenney
Quoted 7 lines · Andrew Morton
Quoted 5 lines · On Mon, 22 Jun 2009 14:49:51 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 3 lines · David Howells
Hi Paul,
Are you going to push your RCU patch for this merge window?
Quoted 8 lines
Quoted 2 lines
Andrew needs to be convinced for that to happen.
whome? I rarely have firm opinions on anything. iirc the question here was "is it worth adding another RCU implementation to save 900 bytes"?
I find it pretty hard to see how to come up with "yes" for that one but it's hardly a huge issue. If you guys feel otherwise then go wild.
Well, I do need to pull the "expedited" interface into the bloatwatch version, and my update of rcutorture made me realize that I can cut out a few more bytes, so I will submit an update. For what it is worth, here are the opinions expressed on LKML:
(quoted diff) +1
-0+ Ingo Molnar: good documentation, minimal RCU implementation.? Andi Kleen: will there be !SMP systems in the future?
(quoted diff) +3
-0+ Lennert Buytenhek: there will be !SMP ARM for a long time. + Paul Mundt: good idea for more-constrained SH platforms. + David Howells: Acked-by. works on FRV board.? Andrew Morton: do we really need another RCU implementation?
Quoted 7 lines
Of course, I well remember programming systems with 4K of core memory back in the 1970s, and therefore feel a bit guilty about sticking deep embedded platforms with the increase in memory footprint represented by Hierarchical RCU compared to Classic RCU. And Bloatwatch RCU is much smaller and easier to understand/maintain than is Classic RCU.
So, again, I will forward port, optimize, test, and resubmit.
IIRC, in previous threads on this topic, the Bloatwatch edition was expected to replace Classic RCU. If so, wouldn't that address Andrew's concern of "adding" another implementation?
Thanks,
Signature · 3 lines
Darren Hart IBM Linux Technology Center Real-Time Linux Team
Quoted 29 lines · Darren Hart
Quoted 28 lines · Paul E. McKenney
Quoted 7 lines · Andrew Morton
Quoted 5 lines · On Mon, 22 Jun 2009 14:49:51 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 3 lines · David Howells
Hi Paul,
Are you going to push your RCU patch for this merge window?
Quoted 8 lines
Quoted 2 lines
Andrew needs to be convinced for that to happen.
whome? I rarely have firm opinions on anything. iirc the question here was "is it worth adding another RCU implementation to save 900 bytes"?
I find it pretty hard to see how to come up with "yes" for that one but it's hardly a huge issue. If you guys feel otherwise then go wild.
Well, I do need to pull the "expedited" interface into the bloatwatch version, and my update of rcutorture made me realize that I can cut out a few more bytes, so I will submit an update. For what it is worth, here are the opinions expressed on LKML:
(quoted diff) +1
-0+ Ingo Molnar: good documentation, minimal RCU implementation.? Andi Kleen: will there be !SMP systems in the future?
(quoted diff) +3
-0+ Lennert Buytenhek: there will be !SMP ARM for a long time. + Paul Mundt: good idea for more-constrained SH platforms. + David Howells: Acked-by. works on FRV board.? Andrew Morton: do we really need another RCU implementation?
Of course, I well remember programming systems with 4K of core memory back in the 1970s, and therefore feel a bit guilty about sticking deep
Quoted 8 lines
Quoted 4 lines
embedded platforms with the increase in memory footprint represented by Hierarchical RCU compared to Classic RCU. And Bloatwatch RCU is much smaller and easier to understand/maintain than is Classic RCU. So, again, I will forward port, optimize, test, and resubmit.
IIRC, in previous threads on this topic, the Bloatwatch edition was expected to replace Classic RCU. If so, wouldn't that address Andrew's concern of "adding" another implementation?
Andrew expressed a preference for dropping Classic RCU without adding Bloatwatch RCU. ;-)
Thanx, Paul
Quoted 11 lines · David Howells
Quoted 5 lines · Paul E. McKenney
Of course, I well remember programming systems with 4K of core memory back in the 1970s, and therefore feel a bit guilty about sticking deep embedded platforms with the increase in memory footprint represented by Hierarchical RCU compared to Classic RCU. And Bloatwatch RCU is much smaller and easier to understand/maintain than is Classic RCU.
Both Fujitsu and Panasonic really want to keep the kernel size down. Squeezing a kernel into a megabyte or less of flash is one of the main aims, and anything that saves nearly 1K is not to be sneered at.
'Nuff said!!!
Here is a sneak preview of v5, testing in progress. The statements below about testing are thus premature, keeping fingers firmly crossed.
Thanx, Paul
------------------------------------------------------------------------
This patch is a version of RCU designed for (!SMP && EMBEDDED) provided as a proof of concept of a small-footprint RCU implementation. In particular, the implementation of synchronize_rcu() is extremely lightweight and high performance. It passes rcutorture testing in each of the four relevant configurations (combinations of NO_HZ and PREEMPT) on x86. This saves 1263 bytes compared to Classic RCU, and more than three kilobytes compared to Hierarchical RCU (updated to 2.6.30):
CONFIG_CLASSIC_RCU: text data bss dec filename 544 32 16 592 kernel/rcupdate.o 1495 200 0 1695 kernel/rcuclassic.o 2287 Total (vs 2112 for v4) CONFIG_TREE_RCU: text data bss dec filename 544 32 16 592 kernel/rcupdate.o 3005 448 0 3453 kernel/rcutree.o 4045 Total (vs 3622 for v4) CONFIG_TINY_RCU: text data bss dec filename 506 32 16 554 kernel/rcupdate.o 442 28 0 470 kernel/rcutiny.o 1024 Total (vs 1041 for v4)
The above is for x86. Your mileage may vary on other platforms.
Changes from v4 (http://lkml.org/lkml/2009/5/2/91) include:
o Squeeze the size down a bit further by removing the
->completed field from struct rcu_ctrlblk.
o This permits synchronize_rcu() to become the empty function.
Previous concerns about rcutorture were unfounded, as rcutorture correctly handles a constant value from rcu_batches_completed() and rcu_batches_completed_bh().
Changes from v3 (http://lkml.org/lkml/2009/3/29/221) include:
o Changed rcu_batches_completed(), rcu_batches_completed_bh()
rcu_enter_nohz(), rcu_exit_nohz(), rcu_nmi_enter(), and rcu_nmi_exit(), to be static inlines, as suggested by David Howells. Doing this saves about 100 bytes from rcutiny.o. (The numbers between v3 and this v4 of the patch are not directly comparable, since they are against different versions of Linux.)
Changes from v2 (http://lkml.org/lkml/2009/2/3/333) include:
o Fix whitespace issues.
o Change short-circuit "||" operator to instead be "+" in order to
fix performance bug noted by "kraai" on LWN. (http://lwn.net/Articles/324348/)
Changes from v1 (http://lkml.org/lkml/2009/1/13/440) include:
o This version depends on EMBEDDED as well as !SMP, as suggested
by Ingo.
o Updated rcu_needs_cpu() to unconditionally return zero,
permitting the CPU to enter dynticks-idle mode at any time. This works because callbacks can be invoked upon entry to dynticks-idle mode.
o I am now OK with this being included, based on a poll at the
Kernel Miniconf at linux.conf.au, where about ten people said that they cared about saving 900 bytes on single-CPU systems.
o Applies to both mainline and tip/core/rcu.
---
include/linux/hardirq.h | 52 +++++++++- include/linux/rcupdate.h | 2 include/linux/rcutiny.h | 102 +++++++++++++++++++++ init/Kconfig | 7 + kernel/Makefile | 1 kernel/rcupdate.c | 4 kernel/rcutiny.c | 227 +++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 388 insertions(+), 7 deletions(-)
include/linux/hardirq.h +45 -7
@@ -130,17 +130,55 @@ static inline void account_system_vtime(struct task_struct *tsk) }#endif -#if defined(CONFIG_NO_HZ ) && !defined(CONFIG_CLASSIC_RCU ) +#if !defined(CONFIG_NO_HZ ) || defined(CONFIG_CLASSIC_RCU ) + +static inline void rcu_irq_enter (void ) +{ +} + +static inline void rcu_irq_exit (void ) +{ +} + +static inline void rcu_nmi_enter (void ) +{ +} + +static inline void rcu_nmi_exit (void ) +{ +} + +#elif defined(CONFIG_TINY_RCU ) + +extern void rcu_enter_nohz (void ); +extern void rcu_exit_nohz (void ); + +static inline void rcu_irq_enter (void ) +{ +rcu_exit_nohz (); +} + +static inline void rcu_irq_exit (void ) +{ +rcu_enter_nohz (); +} + +static inline void rcu_nmi_enter (void ) +{ +} + +static inline void rcu_nmi_exit (void ) +{ +} + +#else +extern void rcu_irq_enter (void );extern void rcu_irq_exit (void );extern void rcu_nmi_enter (void );extern void rcu_nmi_exit (void ); -#else -# define rcu_irq_enter () do { } while (0) -# define rcu_irq_exit () do { } while (0) -# define rcu_nmi_enter () do { } while (0) -# define rcu_nmi_exit () do { } while (0) -#endif /* #if defined(CONFIG_NO_HZ) && !defined(CONFIG_CLASSIC_RCU) */ + +#endif /* * It is safe to do non-atomic ops on ->hardirq_context,
include/linux/rcupdate.h +2 -0
@@ -60,6 +60,8 @@ extern int rcu_scheduler_active;#include <linux/rcutree.h> #elif defined(CONFIG_PREEMPT_RCU )#include <linux/rcupreempt.h> +#elif CONFIG_TINY_RCU +#include <linux/rcutiny.h> #else #error "Unknown RCU implementation specified to kernel configuration"#endif /* #else #if defined(CONFIG_CLASSIC_RCU) */
include/linux/rcutiny.h new file +102 -0
102 lines not on this page · raw message
init/Kconfig +7 -0
@@ -337,6 +337,13 @@ config PREEMPT_RCU now-naive assumptions about each RCU read-side critical section remaining on a given CPU through its execution. +config TINY_RCU + bool "Tiny-Memory RCU" + depends on !SMP && EMBEDDED + help + This option greatly reduces the memory footprint of RCU, + but is usable only on UP systems. + endchoice config RCU_TRACE
kernel/Makefile +1 -0
@@ -81,6 +81,7 @@ obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o obj-$(CONFIG_CLASSIC_RCU) += rcuclassic.o obj-$(CONFIG_TREE_RCU) += rcutree.o obj-$(CONFIG_PREEMPT_RCU) += rcupreempt.o +obj-$(CONFIG_TINY_RCU) += rcutiny.o obj-$(CONFIG_TREE_RCU_TRACE) += rcutree_trace.o obj-$(CONFIG_PREEMPT_RCU_TRACE) += rcupreempt_trace.o obj-$(CONFIG_RELAY) += relay.o
kernel/rcupdate.c +4 -0
@@ -74,6 +74,8 @@ void wakeme_after_rcu(struct rcu_head *head)complete (&rcu->completion); } +#ifndef CONFIG_TINY_RCU +/** * synchronize_rcu - wait until a grace period has elapsed. *
@@ -98,6 +100,8 @@ void synchronize_rcu(void) }EXPORT_SYMBOL_GPL (synchronize_rcu); +#endif /* #ifndef CONFIG_TINY_RCU */ +static void rcu_barrier_callback (struct rcu_head *notused) {if (atomic_dec_and_test (&rcu_barrier_cpu_count))
kernel/rcutiny.c new file +227 -0
227 lines not on this page · raw message
Quoted 39 lines · Paul E. McKenney
Quoted 29 lines · Darren Hart
Quoted 28 lines · Paul E. McKenney
Quoted 7 lines · Andrew Morton
Quoted 5 lines · On Mon, 22 Jun 2009 14:49:51 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 3 lines · David Howells
Hi Paul,
Are you going to push your RCU patch for this merge window?
Quoted 8 lines
Quoted 2 lines
Andrew needs to be convinced for that to happen.
whome? I rarely have firm opinions on anything. iirc the question here was "is it worth adding another RCU implementation to save 900 bytes"?
I find it pretty hard to see how to come up with "yes" for that one but it's hardly a huge issue. If you guys feel otherwise then go wild.
Well, I do need to pull the "expedited" interface into the bloatwatch version, and my update of rcutorture made me realize that I can cut out a few more bytes, so I will submit an update. For what it is worth, here are the opinions expressed on LKML:
(quoted diff) +1
-0+ Ingo Molnar: good documentation, minimal RCU implementation.? Andi Kleen: will there be !SMP systems in the future?
(quoted diff) +3
-0+ Lennert Buytenhek: there will be !SMP ARM for a long time. + Paul Mundt: good idea for more-constrained SH platforms. + David Howells: Acked-by. works on FRV board.? Andrew Morton: do we really need another RCU implementation?
Of course, I well remember programming systems with 4K of core memory back in the 1970s, and therefore feel a bit guilty about sticking deepQuoted 8 lines
Quoted 4 lines
embedded platforms with the increase in memory footprint represented by Hierarchical RCU compared to Classic RCU. And Bloatwatch RCU is much smaller and easier to understand/maintain than is Classic RCU. So, again, I will forward port, optimize, test, and resubmit.
IIRC, in previous threads on this topic, the Bloatwatch edition was expected to replace Classic RCU. If so, wouldn't that address Andrew's concern of "adding" another implementation?
Quoted 2 lines
Andrew expressed a preference for dropping Classic RCU without adding Bloatwatch RCU. ;-)
Yes. In Linux there's no forced 'tie-in' of features and we'll brutally untie them and use the most productive combination, if justified technically ;-)
Ingo
Quoted 42 lines · Ingo Molnar
Quoted 39 lines · Paul E. McKenney
Quoted 37 lines · Darren Hart
Quoted 25 lines · Paul E. McKenney
Quoted 7 lines · Andrew Morton
Quoted 5 lines · On Mon, 22 Jun 2009 14:49:51 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 3 lines · David Howells
Hi Paul,
Are you going to push your RCU patch for this merge window?
Quoted 8 lines
Quoted 2 lines
Andrew needs to be convinced for that to happen.
whome? I rarely have firm opinions on anything. iirc the question here was "is it worth adding another RCU implementation to save 900 bytes"?
I find it pretty hard to see how to come up with "yes" for that one but it's hardly a huge issue. If you guys feel otherwise then go wild.
Well, I do need to pull the "expedited" interface into the bloatwatch version, and my update of rcutorture made me realize that I can cut out a few more bytes, so I will submit an update. For what it is worth, here are the opinions expressed on LKML:
(quoted diff) +1
-0+ Ingo Molnar: good documentation, minimal RCU implementation.? Andi Kleen: will there be !SMP systems in the future?
(quoted diff) +3
-0+ Lennert Buytenhek: there will be !SMP ARM for a long time. + Paul Mundt: good idea for more-constrained SH platforms. + David Howells: Acked-by. works on FRV board.Quoted 7 lines
? Andrew Morton: do we really need another RCU implementation?
Of course, I well remember programming systems with 4K of core memory back in the 1970s, and therefore feel a bit guilty about sticking deep embedded platforms with the increase in memory footprint represented by Hierarchical RCU compared to Classic RCU. And Bloatwatch RCU is much smaller and easier to understand/maintain than is Classic RCU. So, again, I will forward port, optimize, test, and resubmit.IIRC, in previous threads on this topic, the Bloatwatch edition was expected to replace Classic RCU. If so, wouldn't that address Andrew's concern of "adding" another implementation?
Quoted 6 lines
Quoted 2 lines
Andrew expressed a preference for dropping Classic RCU without adding Bloatwatch RCU. ;-)
Yes. In Linux there's no forced 'tie-in' of features and we'll brutally untie them and use the most productive combination, if justified technically ;-)
;-)
Thanx, Paul