diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2010-06-29 19:49:16 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2010-08-20 11:55:00 -0400 |
commit | a57eb940d130477a799dfb24a570ee04979c0f7f (patch) | |
tree | 5add1c135a302cf1c1a454b0620ed17eb802923b /include/linux/sched.h | |
parent | 4d87ffadbba88105f33271bef5f2c79366c6a4e1 (diff) |
rcu: Add a TINY_PREEMPT_RCU
Implement a small-memory-footprint uniprocessor-only implementation of
preemptible RCU. This implementation uses but a single blocked-tasks
list rather than the combinatorial number used per leaf rcu_node by
TREE_PREEMPT_RCU, which reduces memory consumption and greatly simplifies
processing. This version also takes advantage of uniprocessor execution
to accelerate grace periods in the case where there are no readers.
The general design is otherwise broadly similar to that of TREE_PREEMPT_RCU.
This implementation is a step towards having RCU implementation driven
off of the SMP and PREEMPT kernel configuration variables, which can
happen once this implementation has accumulated sufficient experience.
Removed ACCESS_ONCE() from __rcu_read_unlock() and added barrier() as
suggested by Steve Rostedt in order to avoid the compiler-reordering
issue noted by Mathieu Desnoyers (http://lkml.org/lkml/2010/8/16/183).
As can be seen below, CONFIG_TINY_PREEMPT_RCU represents almost 5Kbyte
savings compared to CONFIG_TREE_PREEMPT_RCU. Of course, for non-real-time
workloads, CONFIG_TINY_RCU is even better.
CONFIG_TREE_PREEMPT_RCU
text data bss dec filename
13 0 0 13 kernel/rcupdate.o
6170 825 28 7023 kernel/rcutree.o
----
7026 Total
CONFIG_TINY_PREEMPT_RCU
text data bss dec filename
13 0 0 13 kernel/rcupdate.o
2081 81 8 2170 kernel/rcutiny.o
----
2183 Total
CONFIG_TINY_RCU (non-preemptible)
text data bss dec filename
13 0 0 13 kernel/rcupdate.o
719 25 0 744 kernel/rcutiny.o
---
757 Total
Requested-by: Loïc Minier <loic.minier@canonical.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 2c756666c111..e18473f0eb78 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1202,11 +1202,13 @@ struct task_struct { | |||
1202 | unsigned int policy; | 1202 | unsigned int policy; |
1203 | cpumask_t cpus_allowed; | 1203 | cpumask_t cpus_allowed; |
1204 | 1204 | ||
1205 | #ifdef CONFIG_TREE_PREEMPT_RCU | 1205 | #ifdef CONFIG_PREEMPT_RCU |
1206 | int rcu_read_lock_nesting; | 1206 | int rcu_read_lock_nesting; |
1207 | char rcu_read_unlock_special; | 1207 | char rcu_read_unlock_special; |
1208 | struct rcu_node *rcu_blocked_node; | ||
1209 | struct list_head rcu_node_entry; | 1208 | struct list_head rcu_node_entry; |
1209 | #endif /* #ifdef CONFIG_PREEMPT_RCU */ | ||
1210 | #ifdef CONFIG_TREE_PREEMPT_RCU | ||
1211 | struct rcu_node *rcu_blocked_node; | ||
1210 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | 1212 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ |
1211 | 1213 | ||
1212 | #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) | 1214 | #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) |
@@ -1740,7 +1742,7 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t * | |||
1740 | #define tsk_used_math(p) ((p)->flags & PF_USED_MATH) | 1742 | #define tsk_used_math(p) ((p)->flags & PF_USED_MATH) |
1741 | #define used_math() tsk_used_math(current) | 1743 | #define used_math() tsk_used_math(current) |
1742 | 1744 | ||
1743 | #ifdef CONFIG_TREE_PREEMPT_RCU | 1745 | #ifdef CONFIG_PREEMPT_RCU |
1744 | 1746 | ||
1745 | #define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */ | 1747 | #define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */ |
1746 | #define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */ | 1748 | #define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */ |
@@ -1749,7 +1751,9 @@ static inline void rcu_copy_process(struct task_struct *p) | |||
1749 | { | 1751 | { |
1750 | p->rcu_read_lock_nesting = 0; | 1752 | p->rcu_read_lock_nesting = 0; |
1751 | p->rcu_read_unlock_special = 0; | 1753 | p->rcu_read_unlock_special = 0; |
1754 | #ifdef CONFIG_TREE_PREEMPT_RCU | ||
1752 | p->rcu_blocked_node = NULL; | 1755 | p->rcu_blocked_node = NULL; |
1756 | #endif | ||
1753 | INIT_LIST_HEAD(&p->rcu_node_entry); | 1757 | INIT_LIST_HEAD(&p->rcu_node_entry); |
1754 | } | 1758 | } |
1755 | 1759 | ||